## 3 Methodology
### Federated Learning Approach  
To address privacy concerns and enhance scalability, we implemented Federated Learning (FL). FL allows decentralized model training across multiple devices, ensuring that raw data remains local and is not shared with a central server. This approach preserves data privacy while leveraging the computational power of distributed devices. The Federated Learning process involves:  
1. Initialization: * Start with a global model \(M_{0}\).
2. Local Training: * Each device \(i\) trains the model on its local data \(D_{i}\): \[M_{i}^{\prime}=\text{Train}(M_{i-1},D_{i})\] where \(M_{i-1}\) is the model before training on device \(i\), and \(M_{i}^{\prime}\) is the updated model after training. For local model training, the distribution of data samples among three clients can significantly impact the convergence rate and the model's generalization ability. Each client receives an equal number of samples, totaling 20,136 per client. This balanced distribution ensures that each client has an identical amount of data for training and evaluation purposes in the federated learning setup.
3. Model Aggregation: * Aggregate local model updates using Federated Averaging (FedAvg): \[M_{\text{global}}=\sum_{i}\frac{|D_{i}|}{\sum_{j}|D_{j}|}M_{i}^{\prime}\] where \(|D_{i}|\) is the size of the dataset on device \(i\), and \(\sum_{j}|D_{j}|\) is the total size of all datasets across devices.
4. Iteration: * Repeat steps 2 and 3 until convergence criteria are met. The Federated Averaging (FedAvg) algorithm is given by the following: \[w_{t+1}=\sum_{k=1}^{K}\frac{n_{k}}{n}w_{t}^{k}\] (22) where \(w_{t+1}\) is the updated global model \(w_{t}^{k}\) is the local model from device \(k\), \(n_{k}\) is the number of data points on device \(k\), and \(n\) is the total number of data points across all devices.  
Figure 5 presents the flow of the process regarding federated learning and machine learning in our proposed process. The first step of this process is the initialization of the global model. After this, the model is sent to relevant devices to be trained further. The components of the respective trainable model held on every device are sent back for central processing once the model has been trained locally using the data at the device. These updates are then taken to a central server and combined to make a new and better global model. This process continues until the desired level of performance is achieved by the global model.  
Under Federated Learning, sensitive data are maintained only on local devices, breaking the chain of data breaches. FL further scales by offloading computational load across several devices, which makes it feasible to train models on large and diverse datasets typical of IoV environments. In such a decentralized approach, adaptive learning takes place while guaranteeing that the global model incorporates, in a continuous manner, updates from local devices so that it remains current, facing new traffic patterns and emerging threats. This methodology combines Gini index-based feature selection and federated learning in this paper so that efficient, scalable, and privacy-preserving models can be established for the detection of DDoS attacks in IoV systems. In this regard, considering these challenges in terms of IoV data volume and complexity, the present approach puts forward a robust framework for enhancing smart transportation network security.  
This study uses the CICDDoS2019 (Kaggle: [[https://www.kaggle.com/datasets/dhoogla/cicddos2019](https://www.kaggle.com/datasets/dhoogla/cicddos2019)]([https://www.kaggle.com/datasets/dhoogla/cicddos2019](https://www.kaggle.com/datasets/dhoogla/cicddos2019)) accessed on 25 September 2023), which includes the network traffic information for IoV systems. Armed with the methodology, it now falls upon us to test the validity of the approach in several experiments. Details of the experiment are presented in the next section, including the setup and the results obtained, which present the model's performance on various metrics.