## 2 Materials and Methods
### Model Development  
#### 2.3.1 Adaptive Neuro-Fuzzy Inference System (ANFIS)  
ANFIS network architecture comprises two main parts, namely premise and consequence. ANFIS training can be defined as evaluating parameters that belong to various parts using different types of optimization algorithms. ANFIS uses the pre-existing data  
Figure 3: Location of traffic data collection (**a**–**d**).  
pairs, also known as the input-output pairs, during the model's training. In 1993, [39] devised the fuzzy rules called IF-THEN. These fuzzy rules explain the connectivity of the parts by explaining the structure of the five ANFIS layers. These layers are illustrated in Figure 5, below. Based on the primary aim of this research, the ANFIS structure comprised two inputs and one output, as shown in Figure 5. This ANFIS structure was made up of four membership functions and rules. The different layers are explained based on the ANFIS research done by [20; 40].  
Figure 4: Traffic flow parameters.  
Figure 5: A typical structure of an ANFIS model.  
Layer 1  
This first layer is identified as the layer of fuzzification and uses membership functions to determine and differentiate fuzzy clusters from data inputs. Variables are usually used to evaluate the type of membership functions, and these variables are also known as premise variables. An example of premise variables is {a, b, c}. The degree of membership of each type of membership function is evaluated by applying these variables as explained in the equations below. The different degrees of membership evaluated using this layer are shown in the equation below.  
\[\mu A_{i(x)} =gbell mf(x;a,b,c)=\frac{1}{1+\left\lfloor\frac{x-c}{a}\right\rfloor^{ 2}}\] \[O_{i}^{1} =\mu A_{i}(x)\]  
Layer 2  
In this layer, the firing strengths \(w_{i}\) for layer two, rules are created by applying membership values that can be found in the fuzzification layer. The \(w_{i}\) values can be found by using the multiplication method on the membership values as in the equation below.  
\[O_{i}^{2} =w_{i} =\mu A_{i}(x).\mu B_{i}(y)\] \[i =1,2\]  
Layer 3  
This layer is also known as normalization. It evaluates the strengths of the normalized firing belonging for different rules. The normalized variable is directly proportional to the firing strength of the \(i\)th rule compared to the overall firing strengths as given in the equation below.  
\[O_{i}^{3} =\overline{w_{i}}=\frac{w_{i}}{w_{1}+w_{2}+w_{3}+w_{4}}i\;\epsilon \;\{1,2,3,4\}\]  
Layer 4  
This layer is different from the first three layers because it is known as the defuzzification layer. The equation used to determine the weighted variables of each of the rules in the nodes is evaluated by applying a mathematical expression called the 1 st order polynomial.  
\[O_{i}^{4} =\overline{w_{i}}f_{i}=\overline{w_{i}}(p_{i}x+q_{i}y+r_{i})\]  
The \(w_{i}\) is called the normalization layer output; the set of variables used are \(p_{i},q_{i},r_{i}\). These variables are also known as consequence variables. The overall number of consequence variables attached to each rule is greater than the number of inputs.  
Layer 5  
This layer is also called the summation layer. The initial ANFIS output can be achieved by adding the outputs obtained for the defuzzification layer rules.  
\[O_{i}^{5} =\sum_{i}\overline{w_{i}}f_{i}=\frac{\sum_{i}w_{i}f_{i}}{\sum_{i}w _{i}}\]