## 5 Development of the ANFIS Model and the Framework
One of the limitations of this system is the time needed for training. In the Sugeno membership function, the output of the fuzzy rules are in a linear function form ([PERSON], 1985), [97]. This assumes that two forms of the first order and zero-order have been considered for this linear relationship (fuzzy inference system). Thus, in this model, two inputs and one output are used, as shown in Figure 4. The linear relation between these inputs (Sugeno fuzzy model) [97] would be:  
1. Rule 1: If x is A\({}_{1}\) and y is B\({}_{1}\), THEN f\({}_{1}\) = c\({}_{1}\)x+q\({}_{1}\) y+ R\({}_{1}\)
2. Rule 2: If x is A\({}_{2}\) and y is B\({}_{2}\), THEN f\({}_{2}\) = c\({}_{2}\)x+q\({}_{2}\) y+ R\({}_{2}\)  
where \(c_{i}\), \(q_{i}\), and \(r_{i}\), \((i=1,2)\) are linear parameters of the Sugeno fuzzy model for determining the relation between input and output, and x and y are numerical inputs, while A and B are numerical variables. The system is formed by five layers with a brief explanation of the ANFIS architecture presented in Figure 4, and more detail of the layers discussed in the following section. All computations can be presented in diagrammatic form. ANFIS typically has five layers of neurons, and each layer is from the same function family. The ANFIS structure also has five layers excluding input layer. The first layer designates how much each numerical input relates to the different fuzzy set. Let the MF of fuzzy sets \(Ai\), be \(Bi\), then the output of this layer can be calculated by the next equation (Equation (1)) as follows:  
\[\left\{ \begin{array}{l}O_{i}=\mu_{Ai}(x);\ i=1,2;\\ O_{i}=\mu_{Bi}\ (y);\ i=3,4;\end{array} \right. \tag{1}\]  
As an example, for the MF, a bell function (gbellmf) where \(\{a,b,c\}\) is the parameter set (premise parameters), Equation (2) would be:  
\[f(x,a,b,c)=\frac{1}{1+\left|\frac{x-c}{a}\right|^{2b}} \tag{2}\]  
The outputs of the previous layer constitute the inputs of the next one. The next layer (layer of rules) operates logic operations \"AND\" and \"OR\", which lead to the output value (called firing strength), which can be calculated by Equation (3) as follows:  
\[O_{i}=w_{i}=\mu_{Ai}(x)\mu_{Bi}(y),\ i=1,2. \tag{3}\]  
Figure 4: ANFIS with 5 layers of neurons. where \(w_{i}\) is the value of multiplication of the output of \(Ai\) node and that of \(Bi\) node, which shows the ignition strength of the rule [98; 99]. The next layer (Third layer, layer of normalisation) for each of the outputs of Layer 2 is divided between all of the outputs of that rule, as in Equation (4), as follows:  
\[O_{i}=\overline{w}_{i}=\frac{w_{i}}{\sum_{i}w_{i}} \tag{4}\]  
In the next layer (Layer 4, the clarification layer), the input of each rule for the calculation of model output is computed by Equation (5), as follows:  
\[O_{i}=\overline{w}_{i}f_{i}=\overline{w}_{i}(p_{i}x+q_{i}y+r_{i});\;\mathrm{i }=1,2 \tag{5}\]  
In the last layer (The fifth, the output layer), where the products of the previous neurons are summed with each other and lastly, by defuzzification, fuzzy outputs are transformed into numerical products. Equation (7) explains how this transformation calculated Equation (6), as follows:  
\[f(x,y)=\frac{w_{1}(x,y)f_{1}(x,y)+w_{2}f_{2}(x,y)}{w_{1}(x,y)+w_{2}(x,y)}\;, \tag{6}\]  
or leaving the arguments out (Equation (7)):  
\[f=\frac{w_{1}f_{1}+w_{2}f_{2}}{w_{1}+w_{2}} \tag{7}\]  
This can be separated into phases by first defining Equation (8), as follows:  
\[\overline{w}_{i}=\frac{w_{i}}{w_{1}+w_{2}} \tag{8}\]  
and then \(f\) can be written as Equation (9), as follows:  
\[f=\overline{w_{1}}f_{1}+\overline{w_{2}}f_{2} \tag{9}\]  
Once the premise parameters are fixed, the overall output is a linear combination of the consequent parameters. In symbols, the yield \(f\) can be formed as Equation (10), as follows:  
\[f=(\overline{w_{1}}x)c_{11}+(\overline{w_{1}}y)c_{12}+\overline{w_{1}}c_{10}+ (\overline{w_{2}}x)c_{21}+(\overline{w_{2}}y)c_{22}+\overline{w_{2}}c_{20} \tag{10}\]  
which is linear in the consequent parameters \(c_{ij}\) (\(i\) = 1,2, \(j\) = 0,1,2).