**Meet the editor**

Dr. Elmer P. Dadios finished his doctoral degree at Loughborough University, United Kingdom in 1996. He was a recipient of the Department of Science and Technology (DOST) *50 Men and Women of Science and Technology;* The Department of Science and Technology (DOST) *Scholar Achievers*; The National Research Council of the Philippines *Achievement Award;* The National

Academy of Science and Technology (NAST) *Outstanding Scientific Paper Award.* De La Salle University *Miguel Febres Cordero Research Award*. Dr. Dadios Published and Edited 3 Books on Fuzzy Logic. He had published more than 200 technical papers in Journals and Conference Proceedings. Currently, Dr. Dadios is a University Fellow at the De La Salle University Philippines and holds the highest faculty rank of Full Professor 10. His research interests are: Robotics, Mechatronics, Bioinformatics, Manufacturing Automation, IT, and Computational Intelligent Systems.

## Contents

**Preface XI**



### Preface

This book presents fuzzy logic technique to solve problems in business, transport, environ‐ ment and automation. The book contains six chapters. The first chapter deals with strategy to predict default rate in small and medium-sized businesses using the known client trans‐ actions with the company. The second chapter deals with approach to estimate driving modes in approaching road intersections. This is in real time based on extracted behavioral indices. The third chapter deals with wind energy conversion using double loop fuzzy logic that utilizes low and high frequencies. The fourth chapter deals with Fuzzy Cognitive Maps for Identifying Fault Activation Patterns in Automation Systems. This approach seeks a sol‐ ution that takes advantage of the expert knowledge on local interrelations, but then modifies it towards a global perspective using the features of the abstract graph. The fifth chapter deals with fuzzy logic modeling and performance analysis of a DC drive. The six and last chapter deals with self-tuning fuzzy PI controller for thyristor controlled series capacitor to improve the power system dynamic performance.

> **Prof. Elmer P. Dadios** Professor and University Fellow De La Salle University, Philippines

## **A Simple Fuzzy System Applied to Predict Default Rate**

Fábio M. Soares, Olavo S. Rocha Neto and Hevertton H. K. Barbosa

Additional information is available at the end of the chapter

http://dx.doi.org/10.5772/60079

### **1. Introduction**

Fuzzy systems have been applied in a variety of problems with great success. One key factor is that the fuzzy rules database can be easily designed, in order to emulate a human rational decision making process just as experts usually do while facing hard jobs. Thus, in essence any process that requires human judgment can be translated into simple rules in a fuzzy system, provided that variables can be used in fuzzy sets or linguistic terms. One example is the prediction of a customer's default delay in payment, which seems to be a very simplistic and intuitive process and can be indeed modeled into a set of rules based on an expert's knowl‐ edge.In addition, the facility ofimplementing a fuzzy system can speed up the analysis of huge customer databases, since the usual manual process of analyzing each customer can be automated by a system which in theory has the same ability to infer as the human mind does.

This chapter shows the whole design of the fuzzy system to predict the customers' default rate in small and medium-sized businesses, and how this information can be used to provide a better cash flow estimate. The chapter is structured as follows: in section 2 we present the current economy scenario and why the default is a big problem; in section 3 we analyze some tools that are used to mitigate the risks; in section 4 we explain in details how the fuzzy approach can be exploited in this case; in section 5 we show the design of the fuzzy system; in section 6 we show some results from the simulations of this system; and finally in section 7 we discuss the results and conclude this chapter.

### **2. The default in the microeconomics**

The default in the retail sector is a concerning problem in the modern world [1]. According to the formal definition, the default is a broader term. Technically it means any failure of some

© 2015 The Author(s). Licensee InTech. This chapter is distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

entity, natural or legal, to meet its legal obligations by not paying invoices of loan, services, bonds or wholesales [2]. The term default also applies to the failure of a government to repay its national debt; in that case it is national or sovereign default. In the case of customer default, the concerns are on rent, mortgage, consumer credits, utility payments or funding. While in the first case, the debt is related to the macroeconomic scenario, that means financial crisis over a whole country or continent, the latter is more related to customer's profiles and microeco‐ nomics. That led to the development of risk and credit analysis [3].

The default has a strong effect in developing companies, as well as in small and medium sized business. Mortgage and interest rates could be strongly affected by the customer default rate. Since the whole economy is tightly linked, the default represents a break in this chain, leading, in large scale, to a national level crisis.

**Figure 1.** Economic Chain

When the default happens, it starts a shortcoming in a company's finance, and that means a loss for the provider. Some tools such as financial protection insurance and risk scores may remedy to a certain point, but in most cases they are insufficient to recover from the main problem [4]. However, if one could forecast or predict how many customers would delay payment or how much would be default, the companies would have the chance to prepare itself against a possible low cash flow.

Analysing per sector, it is known that service based industries are usually more affected by defaults.

**Figure 2.** Defaults per Industry. Source: Serasa, 2013 [5]

### **2.1. Reasons for default**

entity, natural or legal, to meet its legal obligations by not paying invoices of loan, services, bonds or wholesales [2]. The term default also applies to the failure of a government to repay its national debt; in that case it is national or sovereign default. In the case of customer default, the concerns are on rent, mortgage, consumer credits, utility payments or funding. While in the first case, the debt is related to the macroeconomic scenario, that means financial crisis over a whole country or continent, the latter is more related to customer's profiles and microeco‐

The default has a strong effect in developing companies, as well as in small and medium sized business. Mortgage and interest rates could be strongly affected by the customer default rate. Since the whole economy is tightly linked, the default represents a break in this chain, leading,

Distributor

Services

When the default happens, it starts a shortcoming in a company's finance, and that means a loss for the provider. Some tools such as financial protection insurance and risk scores may remedy to a certain point, but in most cases they are insufficient to recover from the main problem [4]. However, if one could forecast or predict how many customers would delay payment or how much would be default, the companies would have the chance to prepare

Analysing per sector, it is known that service based industries are usually more affected by

Banks

Production Customers

Retail

nomics. That led to the development of risk and credit analysis [3].

in large scale, to a national level crisis.

2 Fuzzy Logic - Tool for Getting Accurate Solutions

Manufactured Goods Production

Primary Goods

**Figure 1.** Economic Chain

defaults.

itself against a possible low cash flow.

In order to better understand this problem, we should take into account the reasons for consumer default. The recent economic growing and integration speeded up the development of many enterprises, and much of this has been accomplished by the mechanisms of credit and financial leasing [6]. The credit offers expanded to small businesses and so have been to ordinary workers, thus increasing the economic activity [7]. In developing countries such as Brazil, many families from lower and middle classes turned out to actively participate in the economy as voracious consumers [4]. Consequently the debt of Brazilian families rose from 15% in 1992 to over 40% in 2012 [5]. Moreover, by analysing the reasons for the debt, it can be easily perceived that this index is not likely to be lowered, but limiting credit seems also not to be a good option [7]. However, the consumer default is correlated to some behaviours that can be detected in risk analysis systems [8]. Therefore by understanding the reasons for default, this problem can be more controllable.

Upon a report issued by Central Bank of Brazil [9], the causes for consumer default vary from bad financial habits (compulsivity, expenses greater than revenue) to financial problems (unemployment, little wages, crises, default from their clients).

**Figure 3.** Causes for Defaults. Source: Annibal, 2009

Risk Analysis tools take into account as much information as possible from clients in order to evaluate the risk score of a given client. It is known that when a customer faces problems, he or she is more likely to overdue the bills or even not to pay at all. Likewise when customers always pay their bills without delay, it is a good sign they are less likely to delay.

### **2.2. The effects of default in the economy**

The customer default prediction remains a concern for many enterprises, owners, investors and business men all over the world. Every default implies that some party is losing money, since a good or a service has been offered for free without any compensation. In large scale this leads to economy shrinking and inflation [10]. For small companies the effects may be even more drastic due to its small budget. Every small business is oriented to observe its cash flow, but in fact when a customer fails to pay its debt to the company, the cash flow accuracy is severely affected. So there is a need to estimate a percentage of default from its clients. The first and main consequence for small business is that it may not be able to meet its obligations, although it has a quite good financial planning. A second consequence is that the billing department will be overloaded since many bills remain unpaid and the company itself may fail to operate.

### **3. Existing tools for mitigating the risks**

The defaults cannot be prevented, but can be forecasted. Whenever a lender wants to issue credits to a borrower, he may perform an analysis on the financial statements of the borrower in order to assess its capability to comply with its debts [11]. However many aspects may be not considered in traditional risk and credit analysis, since many risk analysis are conducted by means of likelihood and probabilities [2]. On the other hand, there is a call for simpler and quicker risk analysis [12, 13].

Although most of these tools address the credit analysis in the form of a loan, the same procedure applies to any customer that is buying goods/services from a supplier [14], espe‐ cially if it is in the form of leasing or even contracting. Since we are dealing here with the problem of predicting default, our goal is to forecast when a customer will not pay his/debt causing a default. To that end, the methodologies fall particularly on risk and credit analysis, bankruptcy prediction and probability of default.

### **3.1. Risk and credit analysis**

In recent decades, a number of objective, quantitative systems for scoring credits have been developed. The risk of credit is assessed by comparison of accounting ratios of potential borrowers with industry or trends in the financial variables. The banks are provided with many of these ratios, since they are the main credit providers, but that information is not always available to enterprises. Traditional credit risk analyses are implemented in expensive expert systems whose development is very time-consuming. On the other hand simpler forms to grant credit may be achieved by the use of reduced models, such as Balanced Scorecard, Jarrow-Turnbull, among others [15].

Balanced Scorecard, also known as BSC, is actually a management technique aimed at assess‐ ing an enterprise's performance from four perspectives: financial, customer, internal process‐ es, and learning. A balanced score of these indicators makes a system that helps the enterprise to select and focus strategies to achieve goals in the near future. The customer and financial perspective ofthis analysis composes a goodindex to evaluate the risk of servicing a givenclient [12]. But unfortunately this is not always enough to define strategy, and there should be also other performance indicators to determine the risk in a more accurate way.

A reduced form of risk model was published by [16] which is an extension of the Merton model [17] to a random interest rates framework. In this model, risk is modeled as a statistical process. The value of risk is evaluated using a continuous probability of default, estimated in two approaches: Deriving Point in Time (PIT) or Through the Cycle (TTC). The main difference between these approaches regards to internal and external factors. The term PIT applies to probabilities of default that are dependent of general credit conditions or external factors, while TTC applies to probabilities of default that are not subjected to external factors [18].


**Table 1.** Factors Analyzed in PIT and TTC Probabilities

### **3.2. Bankruptcy prediction**

One benefit of risk analysis is that it allows the prediction of bankruptcy for a given entity. One of the oldest methods for bankruptcy prediction was published in 1968 by Altman. His formula is used to predict the probability of bankruptcy within 2 years by using Z-scores. The Z-score is a linear combination of four or five coefficient-weighted common business ratios.

$$Z = 1.2T\_1 + 1.4T\_2 + 3.3T\_3 + 0.6T\_4 + 0.99T\_5 \tag{1}$$

where:

Risk Analysis tools take into account as much information as possible from clients in order to evaluate the risk score of a given client. It is known that when a customer faces problems, he or she is more likely to overdue the bills or even not to pay at all. Likewise when customers

The customer default prediction remains a concern for many enterprises, owners, investors and business men all over the world. Every default implies that some party is losing money, since a good or a service has been offered for free without any compensation. In large scale this leads to economy shrinking and inflation [10]. For small companies the effects may be even more drastic due to its small budget. Every small business is oriented to observe its cash flow, but in fact when a customer fails to pay its debt to the company, the cash flow accuracy is severely affected. So there is a need to estimate a percentage of default from its clients. The first and main consequence for small business is that it may not be able to meet its obligations, although it has a quite good financial planning. A second consequence is that the billing department will be overloaded since many bills remain unpaid and the company itself may

The defaults cannot be prevented, but can be forecasted. Whenever a lender wants to issue credits to a borrower, he may perform an analysis on the financial statements of the borrower in order to assess its capability to comply with its debts [11]. However many aspects may be not considered in traditional risk and credit analysis, since many risk analysis are conducted by means of likelihood and probabilities [2]. On the other hand, there is a call for simpler and

Although most of these tools address the credit analysis in the form of a loan, the same procedure applies to any customer that is buying goods/services from a supplier [14], espe‐ cially if it is in the form of leasing or even contracting. Since we are dealing here with the problem of predicting default, our goal is to forecast when a customer will not pay his/debt causing a default. To that end, the methodologies fall particularly on risk and credit analysis,

In recent decades, a number of objective, quantitative systems for scoring credits have been developed. The risk of credit is assessed by comparison of accounting ratios of potential borrowers with industry or trends in the financial variables. The banks are provided with many of these ratios, since they are the main credit providers, but that information is not always available to enterprises. Traditional credit risk analyses are implemented in expensive expert systems whose development is very time-consuming. On the other hand simpler forms to grant

always pay their bills without delay, it is a good sign they are less likely to delay.

**2.2. The effects of default in the economy**

4 Fuzzy Logic - Tool for Getting Accurate Solutions

**3. Existing tools for mitigating the risks**

bankruptcy prediction and probability of default.

fail to operate.

quicker risk analysis [12, 13].

**3.1. Risk and credit analysis**

T1 is the Working Capital / Total Assets


Z is the score which denotes where an entity will face bankruptcy or not. The Bankruptcy threshold varies on the entity's activity, but in general it is defined as follows

$$\begin{aligned} Z &> 2.99 - \text{NonBandrupt} \\ 1.81 &< Z < 2.99 - \text{Gray Zone} \\ Z &< 1.81 - \text{Bankkrupt} \end{aligned} \tag{2}$$

Altman Z-Score [19] model was found to be 72% accurate in predicting bankruptcy two years before the event with only 6% of false negatives. It is still well accepted by auditors, manage‐ ment accountants and financial directors for load evaluation. However, this model is not recommended for use with financial companies such as banks or factoring, because the balance sheets of companies are usually opaque and the model does not address off-balance sheet items. For prediction of default for financial companies, the Merton Model is used.

Although additional methods for bankruptcy prediction have been developed by taking into account more data, their practicability turned out to be expensive, since it depends on a lot of data to be collected [20].

### **3.3. Probability of default**

Given that many methods of risk and credit analysis, and bankruptcy prediction are based on stochastic models, we are now focusing on the measures for evaluating the probability of default. Most of methods exploit logistic regression functions as well as inversed probability distribution formulas.

The Probability of Default may be used in two ways: to address the causes of default; to predict and prevent new cases of default. Camargos et al [7] performed a survey to find conditioning The Probability of Default may be used in two ways: to address the causes of default; to factors that lead small business to default, as depicted in figure 4.

predict and prevent new cases of default. Camargos (2007) performed a survey to find

conditioning factors that lead small business to default, as depicted in figure 2.

This survey has been conducted in an important Brazilian Program for encouragement of entrepreneurship among small-sized businesses. The method used to assess the risk of

The equation has only one dependent variable X1. A threshold value of 0.5 is selected to determine whether a case is to be classified as compliant or default. Considering the probability as an input for the binary logistic regression variable Y, and then rearranging the

Other models include bivariate probit model by Jacobson and Roszbach (2003), to estimate default probabilities and the effects of default-risk-based acceptance rule changes on a bank's portfolio. Katchova and Barry (2005) used the distance-to-default approach to determine the Value at Risk (VaR). All these models use logistic regression functions on multiple variables. By investigating these models amongst others, Odeh et al (2006) applied a conceptual model for predicting default in agricultural loans, assuming the expected loss

(3)

) ∑ (4)

 ( 

P(X) is the probability of default according to the set of variables X

Fig.4 Variables that influence the default according to Camargos (2007) **Figure 4.** Variables that influence the default according to [7]

coefficients, we obtain a linear logarithmic model:

default was the logistic regression:

where:

β<sup>0</sup> is a model bias constant

β<sup>i</sup> is coefficient for the variable Xi

Xi variable taken into account in the model

is expressed as a result of three components.

This survey has been conducted in an important Brazilian Program for encouragement of entrepreneurship among small-sized businesses. The method used to assess the risk of default was the logistic regression:

$$P(X\_1) = \frac{1}{1 + e^{-X\_1}} \tag{3}$$

The equation has only one dependent variable X1, as the variable influencing on defaut. A threshold value of 0.5 is selected to determine whether a case is to be classified as compliant or default. Considering the probability as an input for the binary logistic regression variable Y, and then rearranging the coefficients, we obtain a linear logarithmic model:

$$\begin{aligned} Y\left(X\_1\right) &= \frac{P\left(X\_1\right)}{1 - P\left(X\_1\right)}\\ Y\left(X\_1\right) &= e^{\theta\_0 + \theta\_1 X\_1} \\ \ln Y(X\_1) &= \theta\_0 + \theta\_1 X\_1 \\ \ln \left(\frac{P\left(X\right)}{1 - P\left(X\right)}\right) &= \theta\_0 + \sum \theta\_i X\_i \end{aligned} \tag{4}$$

where:

(2)

Z is the score which denotes where an entity will face bankruptcy or not. The Bankruptcy

2.99 Non Bankrupt 1.81 2.99 Gray Zone 1.81 Bankrupt

Altman Z-Score [19] model was found to be 72% accurate in predicting bankruptcy two years before the event with only 6% of false negatives. It is still well accepted by auditors, manage‐ ment accountants and financial directors for load evaluation. However, this model is not recommended for use with financial companies such as banks or factoring, because the balance sheets of companies are usually opaque and the model does not address off-balance sheet

Although additional methods for bankruptcy prediction have been developed by taking into account more data, their practicability turned out to be expensive, since it depends on a lot of

Given that many methods of risk and credit analysis, and bankruptcy prediction are based on stochastic models, we are now focusing on the measures for evaluating the probability of default. Most of methods exploit logistic regression functions as well as inversed probability

The Probability of Default may be used in two ways: to address the causes of default; to predict and prevent new cases of default. Camargos et al [7] performed a survey to find conditioning The Probability of Default may be used in two ways: to address the causes of default; to factors that lead small business to default, as depicted in figure 4. predict and prevent new cases of default. Camargos (2007) performed a survey to find

> Financial and Economic Variables

This survey has been conducted in an important Brazilian Program for encouragement of entrepreneurship among small-sized businesses. The method used to assess the risk of

Default

The equation has only one dependent variable X1. A threshold value of 0.5 is selected to determine whether a case is to be classified as compliant or default. Considering the probability as an input for the binary logistic regression variable Y, and then rearranging the

Other models include bivariate probit model by Jacobson and Roszbach (2003), to estimate default probabilities and the effects of default-risk-based acceptance rule changes on a bank's portfolio. Katchova and Barry (2005) used the distance-to-default approach to determine the Value at Risk (VaR). All these models use logistic regression functions on multiple variables. By investigating these models amongst others, Odeh et al (2006) applied a conceptual model for predicting default in agricultural loans, assuming the expected loss

(3)

Socioeconomic Variables

) ∑ (4)

conditioning factors that lead small business to default, as depicted in figure 2.

Fig.4 Variables that influence the default according to Camargos (2007)

 ( 

P(X) is the probability of default according to the set of variables X

items. For prediction of default for financial companies, the Merton Model is used.

threshold varies on the entity's activity, but in general it is defined as follows

*Z Z*

> - << - < -

*Z*

data to be collected [20].

6 Fuzzy Logic - Tool for Getting Accurate Solutions

**3.3. Probability of default**

distribution formulas.

default was the logistic regression:

where:

β<sup>0</sup> is a model bias constant

β<sup>i</sup> is coefficient for the variable Xi

Xi variable taken into account in the model

is expressed as a result of three components.

coefficients, we obtain a linear logarithmic model:

Funding Variables

**Figure 4.** Variables that influence the default according to [7]

P(X) is the probability of default according to the set of variables X

β0 is a model bias constant

βi is coefficient for the variable Xi

Xi variable taken into account in the model

Other models include bivariate probit model by Jacobson and Roszbach [21], to estimate default probabilities and the effects of default-risk-based acceptance rule changes on a bank's portfolio. Katchova and Barry [6] used the distance-to-default approach to determine the Value at Risk (VaR). All these models use logistic regression functions on multiple variables. By investigating these models amongst others, Odeh et al [22] applied a conceptual model for predicting default in agricultural loans, assuming the expected loss is expressed as a result of three components.

$$EL = PD^\*LGD^\*EAD\tag{5}$$

where

EL is the expected loss in monetary units

PD is the probability of default in percentages

LGD is the percentage of loss from the loan volume suffered by the granting institution

EAD is the loan amount plus accrued fees

Usually the Probability of Default is expressed in terms of N customers, so the equation 5 can be rearranged in the form:

$$\text{EL}^{\text{P}} = \frac{\sum\_{i}^{N} \text{PD}\_{i}}{N} \text{\*} LGD^{\ast} \text{EAD} \tag{6}$$

where now

ELP is the expected loss on a specific portfolio

PDi is the probability of default for a specific loan

N is the total of granted loans

Combining the logistic regression (eq. 4) with the conceptual model (eq. 6), we can express the maximum likelihood estimation as in the equation:

$$\ln\left(\frac{PD\_i}{1 - PD\_i}\right) = B^\cdot X + \varepsilon \tag{7}$$

where

PDi is the probability of default as stated in the equation 6

B is a vector of coefficients

X is a vector of explanatory variables and ε is a stochastic error

The coefficients may be determined empirically and vary from many aspects taken from the enterprise's assets. Odeh et al [22] evaluated these methods by using data from Farm Credit System, and found that credit default predictions are really sensitive on data.

### **3.4. Recent approaches**

One of the recent technologies that has evolved and been used are the expert systems. Not only they have been used considerably since the 1980's in financial institutions for decision making tasks, the prediction of default has also been an issue the experts systems have been used for [23]. In addition, computing intelligence techniques, such as Genetic Algorithms, Fuzzy C-Means, and Mars, have also been exploited [24] due to its capability of learning from an expert. The use of neural networks, neuro-fuzzy and fuzzy logic has also grown in recent decades, because they better handle on imprecise information and there is no pure analytical model of the market [25].

Furthermore, the database containing hundreds of financial operations represent an implicit knowledge that is available for modeling and prediction. By means of data mining [14], many customer behaviors can be analyzed based on past values. Thus, more reliable and developed models can be accomplished by the use of artificial intelligence.

### **4. A fuzzy approach**

LGD is the percentage of loss from the loan volume suffered by the granting institution

*N P i i PD EL LGD EAD*

Usually the Probability of Default is expressed in terms of N customers, so the equation 5 can

\* \*

Combining the logistic regression (eq. 4) with the conceptual model (eq. 6), we can express the

'

The coefficients may be determined empirically and vary from many aspects taken from the enterprise's assets. Odeh et al [22] evaluated these methods by using data from Farm Credit

One of the recent technologies that has evolved and been used are the expert systems. Not only they have been used considerably since the 1980's in financial institutions for decision making tasks, the prediction of default has also been an issue the experts systems have been used for [23]. In addition, computing intelligence techniques, such as Genetic Algorithms, Fuzzy C-Means, and Mars, have also been exploited [24] due to its capability of learning from an expert. The use of neural networks, neuro-fuzzy and fuzzy logic has also grown in recent decades,

 ln 1

System, and found that credit default predictions are really sensitive on data.

*i i PD B X PD* æ ö

ç ÷ = +e - è ø

*<sup>N</sup>* <sup>=</sup> <sup>å</sup> (6)

(7)

EAD is the loan amount plus accrued fees

8 Fuzzy Logic - Tool for Getting Accurate Solutions

ELP is the expected loss on a specific portfolio

is the probability of default for a specific loan

maximum likelihood estimation as in the equation:

is the probability of default as stated in the equation 6

X is a vector of explanatory variables and ε is a stochastic error

be rearranged in the form:

N is the total of granted loans

B is a vector of coefficients

**3.4. Recent approaches**

where now

PDi

where

PDi

Fuzzy Systems have already been used in a variety of problems, not only regarding risk and credit analysis, but also bankruptcy and default prediction. A Fuzzy approach combines an easy design fully based both on an expert's opinion and on data history. Zirakja and Samizadeh [8] performed a risk analysis in e-commerce (EC) activities in a more broad vision, including the projects' risk, by relying on experts' opinions to build a fuzzy decision support system (FDSS). Martin et al [24] implemented a fuzzy system to predict bankruptcy by using expert knowledge applied in fuzzy rules with a classification rate of 88% in a single model. In a hybrid model, by using neuro-fuzzy and genetic algorithm, the classification rate was 73,6% but with more input variables.

Fuzzy logic arises as a good tool to emulate expert rules since they don't require too much effort for modeling as other traditional methods do. A fuzzy system can emulate rules of type:

$$\text{IF}\{\text{condition}\}\\
\text{THEN}\{\text{conssequence}\}\tag{8}$$

where conditions and consequences are fuzzy propositions built by linguistic expressions:


The expressions 1 and 2 define "immediate" propositions, and the expressions 3 and 4 define combined propositions. Since they operate over fuzzy variables, they need to be defined in linguistic terms or fuzzy sets. Fuzzy sets usually take the form of membership functions.

$$\mu\_A \left( \mathbf{x} \right) = \begin{cases} 0 \,\text{if } \mathbf{x} \,\text{does not} \,\text{belong} \,\text{to} \,\text{et} \,\, A \\ \text{y} \,\text{if } \mathbf{x} \,\text{ partially belongs to} \,\text{set} \,\, A \\ \quad \mathbf{1} \,\text{if } \mathbf{x} \,\text{fully belongs to} \,\mathbf{st} \,\, A \end{cases} \tag{9}$$

**Figure 5.** Example of a membership function plot.

Fig 5. Example of a membership function plot.

are combined to form relations R. A fuzzy relation is defined against two universes U and V, as U x V being a subset of the Cartesian product of those, so that R: UxV → {0,1}. That means, given A a fuzzy relation and x and y crisp values, if x U and y V then R(x,y)=1, otherwise R(x,y)=0. Therefore, Fuzzy rules can be defined in fuzzy operations as in the equation. Fuzzy expressions are built using boolean operators such as NOT, OR and AND. These expressions are combined to form relations R. A fuzzy relation is defined against two universes U and V, as U x V being a subset of the Cartesian product of those, so that R: UxV → {0,1}. That means, given A a fuzzy relation and x and y crisp values, if x

Fuzzy expressions are built using operators such as NOT, OR and AND. These expressions

∈ U and y

 ∈ V then R(x,y)=1, otherwise R(x,y)=0.

xi is an input fuzzy variable of index i

where R(l) is a Fuzzy rule of index l Therefore, Fuzzy rules can be defined in fuzzy operations as in the equation.

$$\mathbb{R}^{(l)}: \text{If } \mathbf{x}\_1 \text{ is } A\_1^l \text{ AND...AND} \text{ x}\_{\boldsymbol{\upalpha}} \text{is } A\_{\boldsymbol{\upalpha}}^l \text{ THEN } \boldsymbol{y} \text{ is } \mathbb{B}^l\tag{10}$$

(10)

) (11)

l

where

Ai

which in turn can be represented by membership functions R(l) is a Fuzzy rule of index l

 ( xi is an input fuzzy variable of index i

Bl is an output fuzzy set in a rule l

 [ ( )] (12) Ai l is an input fuzzy set of index i in a rule l

where y is an output fuzzy variable

µR(l)(X) is the membership function of the rule µA1l (xi) is the membership function of the input variable of index i on fuzzy set Ai Bl is an output fuzzy set in a rule l

max is the maximum operator

**4.1 Fuzzy System Structure**

µB(y) is the resulting membership function of the output variable y on fuzzy set B in rule l min is the minimum operator which in turn can be represented by membership functions

$$\mu\_{\boldsymbol{\mu}^{(\boldsymbol{\ell})}}(\mathbf{X}) = \min \left( \mu\_{\boldsymbol{\mu}^{\boldsymbol{\ell}}\_{1}}(\mathbf{x}\_{1}), \dots, \mu\_{\boldsymbol{\mu}^{\boldsymbol{\ell}}\_{n}}(\mathbf{x}\_{n}) \right) \tag{11}$$

$$\mu\_{\mathfrak{z}}\left(\mathcal{Y}\right) = \max\_{l=1}^{m} \left[ \sup\_{\mathcal{X} \in \mathcal{U}} \min\left(\mu\_{\mathfrak{z}^{(l)}}(\mathcal{X}), \mu\_{\mathfrak{z}^{(l)}}(\mathcal{Y})\right) \right] \tag{12}$$

### where

Fig 5. Example of a membership function plot.

0 0.2 0.4 0.6 0.8 1 1.2

**Figure 5.** Example of a membership function plot.

10 Fuzzy Logic - Tool for Getting Accurate Solutions

 

<sup>l</sup> is an input fuzzy set of index i in a rule l

µR(l)(X) is the membership function of the rule

is an input fuzzy set of index i in a rule l

which in turn can be represented by membership functions

which in turn can be represented by membership functions

means, given A a fuzzy relation and x and y crisp values, if x

otherwise R(x,y)=0.

R(l) is a Fuzzy rule of index l

y is an output fuzzy variable Bl is an output fuzzy set in a rule l

R(l) is a Fuzzy rule of index l

y is an output fuzzy variable

min is the minimum operator max is the maximum operator sup is the supremum operator

is an output fuzzy set in a rule l

**4.1 Fuzzy System Structure** A Fuzzy System usually has:

xi is an input fuzzy variable of index i

is an input fuzzy variable of index i

( )

∈ V then R(x,y)=1, otherwise R(x,y)=0.

where

∈ U and y

where

µA1l

Ai

where

xi

Ai l

Bl

Fuzzy expressions are built using operators such as NOT, OR and AND. These expressions are combined to form relations R. A fuzzy relation is defined against two universes U and V, as U x V being a subset of the Cartesian product of those, so that R: UxV → {0,1}. That means, given A a fuzzy relation and x and y crisp values, if x U and y V then R(x,y)=1,

Fuzzy expressions are built using boolean operators such as NOT, OR and AND. These expressions are combined to form relations R. A fuzzy relation is defined against two universes U and V, as U x V being a subset of the Cartesian product of those, so that R: UxV → {0,1}. That

(10)

) (11)

l

Therefore, Fuzzy rules can be defined in fuzzy operations as in the equation.

Therefore, Fuzzy rules can be defined in fuzzy operations as in the equation.

(

**Input Variables** (with their respective Fuzzy datasets);

1 1 : ... *<sup>l</sup> l ll R If x is A AND AND x is A THEN y is B n n* (10)

*<sup>n</sup> A A <sup>n</sup> <sup>R</sup>* m =m m *X xx* (11)

é ù m = m m ê ú ë û (12)

[ ( )] (12)

(xi) is the membership function of the input variable of index i on fuzzy set Ai

µB(y) is the resulting membership function of the output variable y on fuzzy set B in rule l

( ) ( ( ) ( )) <sup>1</sup> <sup>1</sup> ( ) min ,..., *<sup>l</sup> l l*

( ) max sup min ( ), ( ) <sup>1</sup> ( (*l*) *<sup>l</sup>* ) *<sup>m</sup> <sup>B</sup> l XU <sup>R</sup> <sup>B</sup> <sup>y</sup> X y* <sup>=</sup> <sup>Î</sup>

µR (l)(X) is the membership function of the rule


min is the minimum operator

max is the maximum operator

sup is the supremum operator

### **4.1. Fuzzy system structure**

A Fuzzy System usually has:


Figure 6 shows the structure of a basic model of fuzzy system, consisting of four components: Input Fuzzification, Rule Database, Inference Machine and Defuzzification.

**Figure 6.** Fuzzy System Structure

A Fuzzy system can be defined in the following operations:


In this chapter we are dealing with the application of a fuzzy system in predicting the default, so the details on these operations are beyond the scope, and for further information the reader is suggested with the references [26, 27].

### **4.2. Reasons to apply fuzzy logic**

Fuzzy systems are relatively simple to create and deploy, and it is fully based on human experts' evaluation. Fuzzy has been applied in many fields involving decision processes which require some sort of judgment. The human mind abstracts real world variables in an imprecise manner forming semantic networks [28]. These semantic networks define relations that can be expressed with linguistic terms just as experts do. Therefore any activity requiring an expert opinion or judgment can be modeled in fuzzy logic rules without the need of an existing theoretic model to lie upon.

In small and medium-sized companies, the financial/collect department usually takes deci‐ sions regarding granting credit or not. Without any supporting tool, the decision is taken purely by an expert's experience or opinion. The same applies for predicting cash flow based on client's past financial transactions. Based on a given customer's history, it can be inferred whether this customer will pay on time or default. This kind of analysis can be performed by an expert, but as a company's portfolio grows, the task of analyzing becomes more timeconsuming and then needs to be automated, and fuzzy systems emerge as a good option to automate this type of analysis [29].

> taken purely by an expert's experience or opinion. The same applies for predicting cash flow based on client's past financial transactions. Based on a given customer's history, it can be inferred whether this customer will pay on time or default. This kind of analysis can be

#### **5. Fuzzy system development** performed by an expert, but as a company's portfolio grows, the task of analyzing becomes more time-consuming and then needs to be automated, and fuzzy systems emerge as a good option to automate this type of analysis [Shang & Hossen, 2013].

following procedure.

records in the form of table.

**5.1 Fuzzy Variables**

Table 2. Accounting Records Database

 Average Payment Delay (APD) Amount Owed (AO)

Maximum Payment Delay (MPD)

By taking into account all the previous information, we designed a system capable of predicting the default rate based on historical records of customers. The methodology used in this design was the same used in the work of [27], which consisted of the following procedure. **5. Fuzzy System Development** By taking into account all the previous information, we designed a system capable of predicting the default rate based on historical records of customers. The methodology used in this design was the same used in the work of Pereira (2012), which consisted of the

According to literature, the default is influenced by many aspects of the customers, but many of them are unknown to the provider, unless they are declared. However, simple models of probability of default can be able to yield good results using statistical measures. So, to make this system more applicable, we took into account only the minimum amount of information a collection or billing department would have regarding customers' transactions. Thus in this work, we considered the database consisting only of customer

**Id Client Description Value Due Date Payment** 23129 Incs. Co. Maintenance apr/12 99.00 20/04/12 24/04/12 23137 Sol. Llc. Development apr/12 1342.00 25/04/12 23/04/12 23144 White Ss. Fin. SSAS fee apr/12 49.90 11/04/12 09/06/12 … … … … … …

According to the database depicted in table 2, we defined the following input variables.

Fig. 7 Fuzzy Modelling Procedure **Figure 7.** Fuzzy Modelling Procedure

According to literature, the default is influenced by many aspects of the customers, but many of them are unknown to the provider, unless they are declared. However, simple models of probability of default can be able to yield good results using statistical measures. So, to make this system more applicable, we took into account only the minimum amount of information a collection or billing department would have regarding customers' transactions. Thus in this work, we considered the database consisting only of customer invoices in the form of table.


**Table 2.** Accounting Records Database

### **5.1. Fuzzy variables**

**• Aggregation:** These operators can group several found output values provided that several

In this chapter we are dealing with the application of a fuzzy system in predicting the default, so the details on these operations are beyond the scope, and for further information the reader

Fuzzy systems are relatively simple to create and deploy, and it is fully based on human experts' evaluation. Fuzzy has been applied in many fields involving decision processes which require some sort of judgment. The human mind abstracts real world variables in an imprecise manner forming semantic networks [28]. These semantic networks define relations that can be expressed with linguistic terms just as experts do. Therefore any activity requiring an expert opinion or judgment can be modeled in fuzzy logic rules without the need of an existing

In small and medium-sized companies, the financial/collect department usually takes deci‐ sions regarding granting credit or not. Without any supporting tool, the decision is taken purely by an expert's experience or opinion. The same applies for predicting cash flow based on client's past financial transactions. Based on a given customer's history, it can be inferred whether this customer will pay on time or default. This kind of analysis can be performed by an expert, but as a company's portfolio grows, the task of analyzing becomes more timeconsuming and then needs to be automated, and fuzzy systems emerge as a good option to

By taking into account all the previous information, we designed a system capable of predicting the default rate based on historical records of customers. The methodology used in this design

> Definition of Rules •Operational Research •Database formation

Definition of Inference Machine Settings •Aggregation •Defuzzification

By taking into account all the previous information, we designed a system capable of predicting the default rate based on historical records of customers. The methodology used in this design was the same used in the work of Pereira (2012), which consisted of the

According to literature, the default is influenced by many aspects of the customers, but many of them are unknown to the provider, unless they are declared. However, simple models of probability of default can be able to yield good results using statistical measures. So, to make this system more applicable, we took into account only the minimum amount of information a collection or billing department would have regarding customers' transactions. Thus in this work, we considered the database consisting only of customer

**Id Client Description Value Due Date Payment** 23129 Incs. Co. Maintenance apr/12 99.00 20/04/12 24/04/12 23137 Sol. Llc. Development apr/12 1342.00 25/04/12 23/04/12 23144 White Ss. Fin. SSAS fee apr/12 49.90 11/04/12 09/06/12 … … … … … …

According to the database depicted in table 2, we defined the following input variables.

taken purely by an expert's experience or opinion. The same applies for predicting cash flow based on client's past financial transactions. Based on a given customer's history, it can be inferred whether this customer will pay on time or default. This kind of analysis can be performed by an expert, but as a company's portfolio grows, the task of analyzing becomes more time-consuming and then needs to be automated, and fuzzy systems emerge as a good

was the same used in the work of [27], which consisted of the following procedure.

option to automate this type of analysis [Shang & Hossen, 2013].

**• Defuzzification:** transform the output found fuzzy values into real world crisp values.

rules may have triggered.

12 Fuzzy Logic - Tool for Getting Accurate Solutions

is suggested with the references [26, 27].

**4.2. Reasons to apply fuzzy logic**

theoretic model to lie upon.

automate this type of analysis [29].

**5. Fuzzy system development**

following procedure.

Definition of Variables •Sets Definition •Membership Functions

**Figure 7.** Fuzzy Modelling Procedure

**5. Fuzzy System Development**

Fig. 7 Fuzzy Modelling Procedure

records in the form of table.

**5.1 Fuzzy Variables**

Table 2. Accounting Records Database

 Average Payment Delay (APD) Amount Owed (AO)

Maximum Payment Delay (MPD)

According to the database depicted in table 2, we defined the following input variables for the fuzzy system.


A formal definition of each variable is outlined in the following equations:

$$APD\_i = \mathbb{E}\left[PD\_i^\dagger - DD\_i^\dagger\right] \tag{13}$$

$$\text{MPD}\_{i} = \max \left[ \text{PD}\_{i}^{\prime} - \text{DD}\_{i}^{\prime} \right] \tag{14}$$

$$\text{AO}\_{i} = \sum\_{j}^{N} \text{AO}\_{i}^{j} \; \forall \; \text{PD}\_{i}^{j} \; \text{is} \; \text{null} \; \text{and } \text{DD}\_{i}^{j} < t \tag{15}$$

$$\text{MACO}\_{i} = \max \left[ \text{AO}\_{i} \right] \; \forall \text{PD}\_{i}^{\vert} > \text{DD}\_{i}^{\vert} \tag{16}$$

$$TC\_i = t - \min\left[D\_i^\vee\right] \tag{17}$$

$$\text{NDC} = \sum\_{i}^{N} \mathbf{1} \; \forall \text{PD}\_{i}^{j} > \text{DD}\_{i}^{j} \; \text{and } \text{DD}\_{i}^{j} < t \tag{18}$$

where

PDij is the Payment Date of the Invoice j of the Client i

DDij is the Due Date of the Invoice j of the Client i

N is the number of issued Invoices

t is the current Date

For specific purposes of this work, a default is considered to be when an invoice is not paid before the due date.

Upon consultation with experts in the collect department, we found the following terms for each of the input variables.


**Table 3.** Fuzzy Input Variables and their Linguistic Terms

The output variables are the values we want to predict, namely when and how much is customer going to pay. That can be express in two ways: Expected Amount/Date of receipt; Probability of Receiving a certain amount within a period of time. Since here we are considering only internal factors, this kind of prediction is through the cycle (TTC). According to Basel II Parameters [10], the simplest approach to estimate the probability of default is logistic regression, taking historical database as a basis for estimation.

Thus, given a date, the probability distribution of payment can be expressed by the following equation:

$$\text{PDR} = \mathbf{A}^{\ast} \mathbf{e}^{(\text{B}^{\ast} \text{EDR}) - (\text{C}/\text{NDC}) - (\text{D}^{\ast} \text{EAR}) - 1} \tag{19}$$

where

min *<sup>j</sup> i i TC t D* = - é ù

For specific purposes of this work, a default is considered to be when an invoice is not paid

Upon consultation with experts in the collect department, we found the following terms for

The output variables are the values we want to predict, namely when and how much is customer going to pay. That can be express in two ways: Expected Amount/Date of receipt; Probability of Receiving a certain amount within a period of time. Since here we are considering only internal factors, this kind of prediction is through the cycle (TTC). According to Basel II Parameters [10], the simplest approach to estimate the probability of default is logistic

Thus, given a date, the probability distribution of payment can be expressed by the following

(B\*EDR) (C/ NDC) (D\*EAR) 1 PDR A\*e - -- = (19)

*jj j ii i*

*NDC PD DD and DD t* ="> < å (18)

1 *N*

*j*

PDij is the Payment Date of the Invoice j of the Client i

**Input Variables Linguistic terms** APD Average Payment Delay Short, Middle, Long AO Amount Owed Low, Middle, High MPD Maximum Payment Delay Short, Middle, Long MAO Maximum Amount Owed Low, Middle, High

TC Time as a Client New, Known, Old Known

NDC Number of Default Cases Low, Middle, High

regression, taking historical database as a basis for estimation.

**Table 3.** Fuzzy Input Variables and their Linguistic Terms

DDij is the Due Date of the Invoice j of the Client i

N is the number of issued Invoices

14 Fuzzy Logic - Tool for Getting Accurate Solutions

t is the current Date

before the due date.

equation:

each of the input variables.

where

ë û (17)

PDR is the Probability of Receipt or Payment

EDR is the Expected Date of Receipt (in days)

EAR is the Expected Amount to Receive (in monetary units)

NDC is the Number of Default Cases

A, B, C and D are coefficients

Upon experiments and linear regression we found the coefficients to be.

$$\begin{aligned} A &= 13.338\\ B &= 1.6231\\ C &= 0.875\\ D &= 22.81 \end{aligned} \tag{20}$$

It can be seen that there is a relation between the next payment date and the probability. So the output variables were chosen to be the next payment and expected amount to be paid.


**Table 4.** Expected Output Variables

However, from these outputs the probability of receiving over time t can also be derived, according to the equation.

$$PP(t) = \bigwedge\_{0}^{t} DRR \; dEDR = \frac{t}{EDR} e^{-\frac{t}{EDR} \ast E} \tag{21}$$

where

PP(t) is the probability of payment over time t

PDR is the probability distribution function

EDR is the expected Date of Receipt

E is the remaining part of the probability distribution function PDR, independent of EDR

Thus, we can state the variables PPW and PPM with parameter values for t of 7 and 30, respectively. The probabilities can also be defined in fuzzy sets.


**Table 5.** Probability Output Variables

Likewise, the expected date of payment can be derived from the quantile equation, which is the inverted probability density function.

$$ER\left(PP\left(t\right)\right) = \frac{-\ln\left(1 - PP\left(t\right)\right)}{\frac{1}{1 + EDR} + E} \tag{22}$$

where ER is the Expected date of payment resulted from the probability distribution PP(t).

### **5.2. Fuzzy set limits**

We defined the fuzzy set limits upon querying against a huge database containing over 5 years of financial records, in such way that each set should have the same number of clients belonging to it. To that end, we had to rearrange the database to group the results per client.


**Table 6.** Accounting Database records grouped by each client

We defined the Gaussian function as a membership function for each set, on input and output. After querying the dataset, we defined the sets' limits as can be show in the table and figures.

$$\mu\_A\left(\mathbf{x}; c; \sigma\right) = e^{-\frac{1}{2}\left(\frac{\mathbf{x} - c}{\sigma}\right)^2} \tag{23}$$

where c is the center of the function, and σ is the variance. Then, we defined as the set's limits c±σ.


**Table 7.** Sets' limits defined upon database querying

**5.3 Fuzzy Rules Figure 8.** Fuzzy Sets' Plots of Variable Average Payment Date

Fig. 8 Fuzzy Sets' Plots of Variable Average Payment Date

[

 ]

STDi is the standard deviation for the difference between due dates and payment dates of

(24)

(25)

#### database shown in table 6 for each combination of the input sets. That would give 729 rules. But before querying a database, we cut some combinations that would never happen in **5.3. Fuzzy rules**

**Output Variables Linguistic terms**

*ER PP t*

**Maximum Delay**

**Table 5.** Probability Output Variables

16 Fuzzy Logic - Tool for Getting Accurate Solutions

**5.2. Fuzzy set limits**

limits c±σ.

**Client Average Delay**

**Table 6.** Accounting Database records grouped by each client

the inverted probability density function.

PPW Probability of Payment in a Week Null, Very Low, Low, Medium, High, Very High PPM Probability of Payment in a Month Null, Very Low, Low, Medium, High, Very High

Likewise, the expected date of payment can be derived from the quantile equation, which is

*PP t*

+

(22)

**Time as Client**

*<sup>E</sup> EDR*

( ( )) ln 1( ( )) 1 1

=

to it. To that end, we had to rearrange the database to group the results per client.


+

where ER is the Expected date of payment resulted from the probability distribution PP(t).

We defined the fuzzy set limits upon querying against a huge database containing over 5 years of financial records, in such way that each set should have the same number of clients belonging

**Amount Owed**

Incs. Co. 5.666 18 0.00 150.00 24 235 Sol. Llc. 0.2222 12 230.00 15500.00 4 346 White Ss. 18.5426 128 57.50 6500.50 16 1448

... ... ... ... ... ... ...

We defined the Gaussian function as a membership function for each set, on input and output. After querying the dataset, we defined the sets' limits as can be show in the table and figures.

where c is the center of the function, and σ is the variance. Then, we defined as the set's

<sup>2</sup> <sup>1</sup>

æ -ö - ç ÷

*x c*

( )

*<sup>A</sup> xc e*

<sup>2</sup> ; ;

**Maximum Owed**

è ø <sup>s</sup> m s= (23)

**Number of Cases**

> practice or could be intuitively disposed. Some examples are the following rules: *If APD is long and MPD is short and … If AO is high and MAO is short and … If TC is new and NDC is high and …* By cutting infeasible rules, the rules database has been reduced to 288 rules. The outputs for As performed in the work of [27], we have built the fuzzy rules upon querying the database shown in table 6 for each combination of the input sets. That would give 729 rules. But before querying a database, we cut some combinations that would never happen in practice or could be intuitively disposed. Some examples are the following rules:

As performed in the work of Pereira (2012), we have built the fuzzy rules upon querying the

each rule, both for expected date and amount of receipt, have been determined upon querying the history database. Nevertheless, some situations never happened, so we had to *If APD is long and MPD is short and...*

decide the output by asking the experts. That procedure trimmed down the rule database to 53 rules. *If AO is high and MAO is short and...*

For a given rule, we found and average difference between the due date and the payment date. *If TC is new and NDC is high and...*

√ \*(

where

the client i.

 ) +

APDi is the average payment date for the client i;

By cutting infeasible rules, the rules database has been reduced to 288 rules. The outputs for each rule, both for expected date and amount of receipt, have been determined upon querying the history database. Nevertheless, some situations never happened, so we had to decide the output for these rules by asking the experts. That procedure trimmed down the rule database to only 53 rules

For a given rule, we found an average difference between the due date and the payment date.

$$APD\_i = \mathbb{E}\left[\mathbf{PD}\_i^j - \mathbf{DD}\_i^j\right] \,\,\forall \mathbf{DD}\_i^j > t \tag{24}$$

$$\text{STD}\_{i} = \sqrt{\mathbb{E}\left[\left(\text{PD}\_{i}^{j} - \text{DD}\_{i}^{j}\right)^{2}\right] - \text{APD}\_{i}^{2}} \tag{25}$$

where

APDi is the average payment date for the client i;

STDi is the standard deviation for the difference between due dates and payment dates of the client i.

After querying the database for any given rule, we built out a histogram of each fuzzy output variable corresponding to that rule. Table 8 shows a histogram found for the following rule:

"if **APD** is *Middle* and **AO** is *Low* and **MPD** is *Long* and **MAO** is *Low* and **TC** is *Old Known* and **NDC** is *Low*"


**Table 8.** Histogram for a given rule

The output set was chosen as the one that the rule result better fits into, which is *Near* for **Expected Date of Receipt** and *Integral* for **Expected Amount of Receipt**.

### **5.4. Database preparation**

In order to have a separation between the rules database development and the validation, we defined distinct periods for querying and for validation. The database in the form shown in table 6 has been cut into these two periods, 2 years and a half each, forming a new database grouped by period. This database is shown in table 9.


**Table 9.** Database split into 2 periods

By cutting infeasible rules, the rules database has been reduced to 288 rules. The outputs for each rule, both for expected date and amount of receipt, have been determined upon querying the history database. Nevertheless, some situations never happened, so we had to decide the output for these rules by asking the experts. That procedure trimmed down the rule database

For a given rule, we found an average difference between the due date and the payment date.

ë û (24)

ë û (25)

*jj j APD E PD DD DD t i ii i* = - "> é ù

( )

STDi is the standard deviation for the difference between due dates and payment dates of the

After querying the database for any given rule, we built out a histogram of each fuzzy output variable corresponding to that rule. Table 8 shows a histogram found for the following rule: "if **APD** is *Middle* and **AO** is *Low* and **MPD** is *Long* and **MAO** is *Low* and **TC** is *Old Known* and

3 2 1 0

0 0 1 5

The output set was chosen as the one that the rule result better fits into, which is *Near* for

In order to have a separation between the rules database development and the validation, we defined distinct periods for querying and for validation. The database in the form shown in table 6 has been cut into these two periods, 2 years and a half each, forming a new database

**Expected Date of Receipt** and *Integral* for **Expected Amount of Receipt**.

grouped by period. This database is shown in table 9.

**None/Near Little/Reasonably Near Enough/Far Integral/Never**

*i ii i STD E PD DD APD* é ù = -- ê ú

APDi is the average payment date for the client i;

<sup>2</sup> *j j* <sup>2</sup>

to only 53 rules

18 Fuzzy Logic - Tool for Getting Accurate Solutions

where

client i.

**NDC** is *Low*"

**Expected Date of**

**Expected Amount of**

**Table 8.** Histogram for a given rule

**5.4. Database preparation**

**Receipt**

**Receipt**

The validation period was replicated multiple times in order to perform a continuous valida‐ tion from first until the last date of the period. For each date, a snapshot of the database of table 6 was taken in order to simulate the Fuzzy Prediction.

**Figure 9.** Schema of database snapshots taken for every date in the periods for simulation


**Table 10.** Database with time dimension

### **5.5. Further fuzzy settings**

The fuzzy system was implemented using Mamdani [26] as the inference machine, because of its simplicity in processing the rules and values and ease to be implemented in this case. Then it was deployed on an important Brazilian Financial Accounting System whose aim was to infer how much of the accounts receivable could be received within a week or a month, and what would be the default rate. The fuzzy system was set up as follows.


**Table 11.** Fuzzy Settings

### **6. Results and simulation**

After defining and validating the rules database, we performed a simulation of prediction the default rate in a period of 2 years and a half. Since we have a probability as an output, we had to apply the Monte Carlo method to generate random numbers and get real results from the simulations and confront them against the real values [30].

### **6.1. Simulation procedure**

We used the database shown in table 10 to perform simulations on any record for every invoice which was supposed to be paid. The fuzzy system would give an expected date and amount to be received. So we applied for a given record some calculations using equations 19, 21 and 22 to get probabilities of payment within a day, a week and a month. With the Monte Carlo method, we have gotten a number of random values to be applied in the probability distribu‐ tion as shown in the equations 21 and 22. If that random number would be greater less than the corresponding probability value, calculated in the equations 21 and 22, it means the debt has been paid.

The algorithm for the simulation was defined as follows.

Then, we performed simulations to predict:


**Figure 10.** Flowchart of the simulation

**5.5. Further fuzzy settings**

20 Fuzzy Logic - Tool for Getting Accurate Solutions

**Table 11.** Fuzzy Settings

**6. Results and simulation**

**6.1. Simulation procedure**

has been paid.

The fuzzy system was implemented using Mamdani [26] as the inference machine, because of its simplicity in processing the rules and values and ease to be implemented in this case. Then it was deployed on an important Brazilian Financial Accounting System whose aim was to infer how much of the accounts receivable could be received within a week or a month, and

After defining and validating the rules database, we performed a simulation of prediction the default rate in a period of 2 years and a half. Since we have a probability as an output, we had to apply the Monte Carlo method to generate random numbers and get real results from the

We used the database shown in table 10 to perform simulations on any record for every invoice which was supposed to be paid. The fuzzy system would give an expected date and amount to be received. So we applied for a given record some calculations using equations 19, 21 and 22 to get probabilities of payment within a day, a week and a month. With the Monte Carlo method, we have gotten a number of random values to be applied in the probability distribu‐ tion as shown in the equations 21 and 22. If that random number would be greater less than the corresponding probability value, calculated in the equations 21 and 22, it means the debt

what would be the default rate. The fuzzy system was set up as follows.

**Input Fuzzy Sets** *Gaussian* **Output Fuzzy Sets** *Triangle* **Implication Method** *AND/OR* **Aggregation Method** *Product*

**Defuzzification Method** *Centre of gravity*

simulations and confront them against the real values [30].

The algorithm for the simulation was defined as follows.

**•** the future revenue within a short period (a month)

Then, we performed simulations to predict:

**•** the revenue within a long term (a year)

**•** the default rate of customers

### **6.2. Prediction of the default rate**

The default rate is assumed to be the percentage of invoices that are delayed or paid after the due date:

$$DR\left(t\right) = \frac{\sum AO\_i \; \forall PD\_i > DD\_i \; and \; DD\_i < t}{\sum AO\_i \; \forall DD\_i < t} \tag{26}$$

where DR(t) is the default rate at the date t.

Then we applied the Fuzzy system to give an expected percentage of invoices that were about to be paid after due date, and compared to what happened in fact. We repeated the experiments 100 times, in order to have more accurate values. The results are outlined in table 12.


**Table 12.** Some results from predictions. Correct estimations are bolded.

The following plots show how the default rate is predicted from the Fuzzy system over time. One data series is the actual default rate per month, and the other is the average prediction after simulating a 100 times.

**Figure 11.** Prediction of the Default Rate

By applying this procedure, one can infer the revenue over a period, using the expected amount to be paid as the output value in addition to the expected date of payment. The expected revenue is then set to be:

$$PER\_i = PEPR\_i + DR\_i \, ^\ast ER\_i \tag{27}$$

where

PERi is the Predicted revenue for the period i

PEPRi is the Predicted revenue from past periods of period i

DRi is the default rate for period i

ERi is the original expected revenue for period i

### **6.3. Forecasting revenue**

We processed the results from the default rate prediction and built several snapshots out of the simulations to forecast the revenue over each period by taking into account recent real records up to the current period.

The results are outlined in the plots shown in figure 12.

### **6.4. Long term simulations**

The following plots show how the default rate is predicted from the Fuzzy system over time. One data series is the actual default rate per month, and the other is the average prediction

By applying this procedure, one can infer the revenue over a period, using the expected amount to be paid as the output value in addition to the expected date of payment. The expected

We processed the results from the default rate prediction and built several snapshots out of the simulations to forecast the revenue over each period by taking into account recent real

\* *i i ii PER PEPR DR ER* = + (27)

after simulating a 100 times.

22 Fuzzy Logic - Tool for Getting Accurate Solutions

**Figure 11.** Prediction of the Default Rate

PERi is the Predicted revenue for the period i

ERi is the original expected revenue for period i

The results are outlined in the plots shown in figure 12.

DRi is the default rate for period i

records up to the current period.

**6.3. Forecasting revenue**

PEPRi is the Predicted revenue from past periods of period i

revenue is then set to be:

where

To calculate how much the enterprise expects to receive in the long term, we performed random simulations on the probabilities given by the fuzzy system for the whole period. By checking the history for each client until the present moment in the simulation, and an estimative of when this client will pay is obtained. For validation we compared the predicted default rate against the real default rate that happened in the period. The system was validated with a 12 month period simulation using past values for 100 times. This strategy was able to give a prediction of the default rate with an 80% accuracy.

**Figure 12.** Bar charts comparing the expected, real and predicted revenue for one year

As can be seen, the fuzzy system has learned the expert's knowledge, therefore acting as a process expert and releasing them from the task of analysing, judging, and change the chosen values, then becoming able to do other activities.

### **7. Discussions and conclusion**

The results produced by this initiative show how the default issue can be addressed by the use of Fuzzy Systems. The default in the economy is a serious problem, and although this problem cannot be solved easily, the facility to predict it can prevent bad clients to buy services for which it is not able to pay. Moreover, the Fuzzy System can be used to infer and forecast a more accurate cash flow, instead of traditional approaches.

One important advantage of this fuzzy system to forecast defaults is that it needed just a little piece of information to predict when a given customer would default a payment and under which probability. The simulation using quantitative techniques such as Monte Carlo method turned out a good estimation because of the stochastic nature of this process. Many models of the probability of default rely on statistical methods to infer the probabilities. This is an interesting option when there is little data available on the customers to forecast default or bankruptcy by taking into account TTC probabilities.

The system has been applied in an Accounting System having aided financial analysts with predictions on cash flow and liquidity. One drawback of this system though is the lack of good predictions on new clients' transactions, but even in these cases the predictions are within the margin established by the fuzzy sets. However these results can be improved by performing risk and credit analysis or taking into account more information from the clients in the fuzzy system.

### **Author details**

Fábio M. Soares\* , Olavo S. Rocha Neto and Hevertton H. K. Barbosa

\*Address all correspondence to: fabio@exodus.eti.br

Exodus Sistemas, Brazil

### **References**


lo.br/scielo.php?pid=S1415-65552010000200009&script=sci\_arttext accessed in June 2014.

[8] Zirakja, M.H., Samizadeh, R., (2011) Risk Analysis in E-commerce via Fuzzy Logic, Int. Journal Management Business, Summer 2011, pp 99-112.

interesting option when there is little data available on the customers to forecast default or

The system has been applied in an Accounting System having aided financial analysts with predictions on cash flow and liquidity. One drawback of this system though is the lack of good predictions on new clients' transactions, but even in these cases the predictions are within the margin established by the fuzzy sets. However these results can be improved by performing risk and credit analysis or taking into account more information from the clients in the fuzzy

, Olavo S. Rocha Neto and Hevertton H. K. Barbosa

[1] Fonseca, R.A., Francisco, J.R. de S., Amaral, H.F., Bertucci, L.A., (2013) Impact of De‐ faults in Commercial Sector, Revista da Faculdade de Administração e Economia, v.

[2] de Severigny, A., Renault, O, (2004) The Standard & Poor's Guide to Measuring and

[3] Duffie, D., Singleton, K.J., (2003), Credit Risk: Pricing, Measurement, and Manage‐

[4] CNC (2013) Pesquisa Nacional de Intenção de Consumo das Famílias, http:// www.cnc.org.br/central-do-conhecimento/pesquisas/pesquisa-nacional-de-intencao-

[5] Serasa Experian (2013), Economic Indicators and Default in Brazil, http://noti‐ cias.serasaexperian.com.br/indicadores-economicos/inadimplencia-das-empresas (ac‐

[6] Katchova, A.L., Barry, P.J., (2005) Credit Risk Models and Agricultural Lending,

[7] Camargos, M.A., Camargos, M.A.S., Silva, F.W., Santos, F.S., Rodrigues, P.J., (2004) Determining factors of the default in processes of credit concession to micro and small businesses in the State of Minas Gerais (in Portuguese), Revista de Administra‐ ção Contemporânea vol 14. no.2, ISSN 1982-7849, online version: http://www.scie‐

American Journal of Agricultural Economics 87, no 1 2005, pp 194-205.

Managing Credit Risk, McGraw-Hill, New York, US ISBN 0-07-141755-9.

ment. Princeton University Press. Princeton, US, ISBN 0-691-09046-7.

de-consumo-das-familias-icf-janeir-0 , accessed in June 2014.

bankruptcy by taking into account TTC probabilities.

24 Fuzzy Logic - Tool for Getting Accurate Solutions

\*Address all correspondence to: fabio@exodus.eti.br

system.

**Author details**

Fábio M. Soares\*

**References**

Exodus Sistemas, Brazil

4, n.2, pp.39-60.

cessed in June 2014).

