## 4 Methodology
### Feedforward Artificial Neural Network  
An FF-ANN is largely composed of three layers, as shown in Figure 9: input, hidden, and output layers. The input layer contains the input variables, which are preselected based on their relation to the output. Selection of the input variable is an important process, as an incorrect selection could lead to overfeeding or underfitting the output. Likewise, the output layer represents the output obtained from the network or the results of the FF-ANN. The hidden layers consist of neurons which can be designed with multiple hidden layers and have the number of neurons in each layer changed. Some heuristic methods such as particle swarm optimization (PSO), a genetic algorithm (GA), and a combination of both are used to decide the number of layers by finding the global minima based on an error in forecasting [15]. However, in most cases, the selection is performed through a gradual increment in the number of layers and neurons and compared with the error [7]. In Figure 9, the \(n\) represents the number of hidden layers. Each layer consists of neurons connected by a weighted channel, which represents the weight of the data passed, and \(w_{n}\) presents the weight assigned to every connection. At each neuron, data are passed through an activation function (e.g., log-sigmoid, sigmoid, or tan-sigmoid) which determines if each particular neuron is activated or not. Based on the activated neuron, the data are further transmitted to the next layer of the neuron's overweighted channel. The transmission of data is in a forward direction and hence is called the forward propagation of the network. The network is a model in two phases: training and testing. During the training phase, each output is compared with the actual output to realize the error, which works as feedback to the network in the second iteration. The process of training the network is known as backpropagation. Backpropagation helps to adjust the weight based on the given error obtained between the target and the output [15]. It is a form of supervised learning in which the input is repeatedly presented to the network with an error from the previous iteration. The input signal going to each node can be presented as in Equation (8):  
\[V_{j}=\sum_{i=1}^{n}X_{i}\times W_{ij}+B_{j} \tag{8}\]  
where \(i\) represents the number of inputs, \(j\) represents the number of hidden layers, \(X_{i}\) represents the \(i\)th input, and \(W_{ij}\) represents the weight channel from the \(i\)th input node to the \(j\)th hidden layer. The signal passed through the activation function which decides the activation of the node is presented in Equation (9). The hyperbolic tangent sigmoid transfer function is used as an activation function to train the network:  
\[Y_{j}=\varnothing\left(V_{j}\right)=\varnothing\left(\sum_{i=1}^{n}X_{i}\times W _{ij}+B_{j}\right) \tag{9}\]  
where \(\varnothing\) is the activation function and \(Y_{j}\) presents the output from each node. Similarly, each input signal is passed throughout the defined number of nodes, and the final output is obtained as result. In the case of supervised learning, the method in every weight iteration is updated. Among multiple backpropagation learning methods, the Levenberg-Marquardt algorithm is designed to minimize the sum of the sure error function to update the weight  
Figure 9: Feedforward neural network structure. in the ANN. This backpropagation method is considered the fastest learning method in MATLAB for simulations [35]. The updated weight is presented in Equation (10):  
\[W(j+1)=W_{j}-\left[J^{T}\times J+\mu\times I\right]^{-1}\times J^{T}\times e \tag{10}\]  
where \(J\) is the Jacobian matrix that contains the derivative of the error calculated using the initial iteration of weights and biases and \(e\) is the error calculated for each iteration. The equation presents a combination of [PERSON]'s methods and gradient descent.