## 4 Experiments and Results
### Evaluation  
We conducted a performance evaluation of several machine learning models over all available features and afterward performed the Gini index for feature selection to limit the number of features to 25. We conducted model retraining and model evaluation on these selected features. The accuracy of the system Acc is mathematically defined as the proportion of correctly predicted instances to the total instances:  
\[\text{Accuracy}=\frac{\sum_{i=1}^{N}I(\hat{y}_{i}=y_{i})}{N} \tag{23}\]  
where \(N\) is the total number of instances, \(\hat{y}_{i}\) is the predicted label for instance \(i\), and \(y_{i}\) is the true label. The indicator function \(I(\cdot)\) equals 1 if the condition inside is true and 0 otherwise. The Gini index \(\text{Gini}(S)\) for feature selection is calculated as follows:  
\[\text{Gini}(S)=1-\sum_{j=1}^{m}\left(\frac{|S_{j}|}{|S|}\right)^{2} \tag{24}\]  
where \(S\) is the set of features, \(S_{j}\) is the subset of \(S\) that contains feature \(j\), \(|S|\) is the total number of instances in \(S\), and \(m\) is the number of features. We evaluated the performance of machine learning models using all features and the selected features obtained through the Gini index-based feature selection. The results are summarized in Table 4.  
The results in Table 4 illustrate that feature selection using the Gini index, which reduced the feature set from 83 to 25, either maintained or enhanced model performance. Specifically, the Decision Tree and Random Forest classifiers showed slight improvements in accuracy, increasing from 0.92 to 0.93. The XGBoost Classifier and Gradient Boosting preserved their high accuracy of 0.94 and 0.93, respectively, with the reduced feature set. The KNeighborsClassifier's accuracy remained unchanged at 0.85. These results indicate that the feature selection process effectively simplified the models without compromising their accuracy. Table 5 highlights an extensive comparison of the classification capabilities of different models with the combination of two methodologies, i.e., taking only 25 features and employing federated learning techniques. The performance measures treated include accuracy, macroaverage Average Precision, Macro Average Recall, Macro Average F1 score, Weighted Average Precision, Weighted Average Recall, and Weighted Average F1 score. The collective results show that the models perform quite well under the two approaches with high levels of performance, where XGBoost and Random Forest achieve the best accuracy. Particularly, the use of federated learning leads to slightly lower values of performance measures than the case using selected features. This is notwithstanding the amount of data privacy and decentralization aspects offered by federated learning, which are very important in many real applications. The Gini index-based feature selection reduced the feature set from 88 to 25, resulting in approximately 30% less computational overhead without compromising accuracy. This reduction, applied to a dataset of 75,510 samples, ensures that real-time DDoS detection on edge devices is feasible, with faster response times and reduced resource usage. As shown in Figure 6, the Receiver Operating Characteristic (ROC) curves for each model in this study offer a comprehensive evaluation of their classification performance. By analyzing the Area Under the Curve (AUC) scores, we gain valuable insights into how effectively each model identifies patterns within the dataset. Higher AUC scores indicate better model performance, suggesting a greater ability to distinguish between classes accurately. In Figure 5(a), we see the Decision Tree model, which exhibits moderate performance as indicated by its AUC score. This suggests that while it can identify some patterns, it may not be very reliable on its own. Moving on to Figure 5(b), the Random Forest model stands out with improved performance. Thanks to its ensemble approach, which combines the strengths of multiple decision trees, it achieves a higher AUC score and demonstrates better generalization.