## 3 WFL-Based Proposed Model
### Federated Learning-Based Low-Rate DDoS Detection
#### 3.2.1 Local Client Training  
After collecting the dataset from various networks, it is fed to an ANN. The ANN hierarchy depends on three layers: the input layer, the hidden layer, and the output layer, which is adapted from human neuron behavior given in Figure 4.  
In Figure 4, \(f_{1},f_{2},f_{3},\ldots f_{n}\) represent the input features, where the circles inside the layer represent the neurons, and the index \(i,j,\) and \(k\) represents the element index in each layer. In every layer, some bias is added, which is shown as \(b_{1}\) and \(b_{2}\). The weights between the input to the hidden layer are indicated by \(u_{ij}\) and \(v_{jk}\) shows the weights between the hidden layer and the output layer. The total number of elements in the input layer, hidden layer, and output layer is \(n,m,\) and \(p\), respectively, which gives the dimensions of each layer.  
The output at each neuron from the hidden layer can be calculated using the Sigmoid function given in Equation (1), in which \(oh_{j}^{cl_{i}}\) represents the output of \(i\)th client \(cl_{i}\) of \(j\)th hidden neuron times input features added with some bias \(b_{1}\).  
\[oh_{j}^{cl_{i}}=\frac{1}{1+e^{-(\sum_{l=1}^{m}u_{j,l}^{cl_{i}}f_{l}+b_{1})}}1 \leq j\leq m \tag{1}\]  
Similarly, \(oo_{k}^{cl_{i}}\) represents the output at the output layer at \(k\)th neuron in Equation (2).  
\[oo_{k}^{cl_{i}}=\frac{1}{1+e^{-(\sum_{l=1}^{m}v_{jl}^{cl_{i}}o_{j}^{cl_{i}}+b_{ 2})}}1\leq k\leq p \tag{2}\]  
The difference between the actual and estimated output is an error, which can be calculated using Equation (3), in which \(Err^{cl_{i}}\) represents the error of the \(i\)th client \(cl_{i}\), and \(ao_{k}^{cl_{i}}\) represents the actual output while \(oo_{k}^{cl_{i}}\) represent the estimated output at the output layer.  
\[Err^{cl_{i}}=\frac{1}{2}\sum_{k=1}^{p}{(ao_{k}^{cl_{i}}-oo_{k}^{cl_{i}})^{2}} \tag{3}\]  
Based on the forward and backward propagation mechanism in ANN, the weights between the layers are adjusted to the optimal value by minimizing the error, as mentioned in Equation (3). To find the minimized error, the weight change between the output layer  
Figure 4: Artificial Neural Network block diagram.  
Equation (13) can also reduce to Equation (14),  
\[\Delta u_{i,j}^{cl_{i}}=const\beta_{j}^{cl_{i}}\times f_{i} \tag{14}\]  
by replacing constant factor \(\beta_{j}^{cl_{i}}\).  
\[\beta_{j}^{cl_{i}}=\left[\sum_{k}\gamma_{k}^{cl_{i}}*v_{j,k}^{cl_{i}}\right] \times oh_{j}^{cl_{i}}\times(1-oh_{j}^{cl_{i}}) \tag{15}\]  
The weights between the hidden to input layers can also be updated iteratively by adding the change in the weights times the learning factor to the current weight.  
\[u_{ij}^{cl_{i}}(t+1)=u_{ij}^{cl_{i}}(t)+\lambda\Delta u_{ij}^{cl_{i}} \tag{16}\]  
Optimum weights of local training will be achieved by using Equations (10) and (16), and these weights will be transferred to the federated server for the aggregation the process to form a global model as shown in Algorithm 1.  
```
1:Start
2:Split the local data to mini-batches of size \(B_{s}\)
3:Initialize input layer and hidden layer weights (\(U_{IH^{\prime}}^{cl_{i}}(V_{HO}^{cl_{i}})\) and of Epochs t = 0
4:for each mini-batch \(B_{s}\)do
5:for the feed-forward phase to do
6: Calculate \(oh_{j}^{cl_{i}}\) using Equation (1)
7: Calculate estimated output \(oo_{k}^{cl_{i}}\) using Equation (2)
8:endfor
9: Calculate the Error Value \(Err^{cl_{i}}\) using Equation (3)
10:for Backpropagation OR weights updating phase do
11: Calculate the \(\Delta v_{j,k}^{cl_{i}}\) using Equation (8)
12: Calculate the \(\Delta u_{ij}^{cl_{i}}\) using Equation (14)
13: Update the weights \(v_{j,k}^{cl}(t+1)\) using Equation (10)
14: Update the weights \(u_{ij}^{cl}(t+1)\) using Equation (16)
15:endfor
16:endfor
17:if stopping Criteria do not meet then
18: goto Step 4
19:else
20: goto Step 22
21:endif
22: Return optimum weights (\(U_{IH}^{cl_{i}},V_{HO}^{cl_{i}}\)) to Federated Server
23: Stop
```  
**Algorithm 1** Client server algorithm