## 4 Experiments and Results
### Evaluation
This indicates that it is more robust and can adapt more effectively to new data. Figure 5(c) showcases the XGBoost model, which shines with the highest AUC score among all models. This impressive performance is attributed to its gradient boosting technique, which optimizes predictions by focusing on errors from previous iterations, making it a powerful tool for accurate predictions. In Figure 5(d), we see \begin{table}
\begin{tabular}{l c c} \hline \hline
**Models** & **All Features Acc** & **25 Features Acc** \\ \hline Decision Tree & 0.92\% & 0.93\% \\ \hline Random Forest & 0.92\% & 0.93\% \\ \hline XGBoost Classifier & 0.94\% & 0.94\% \\ \hline Gradient Boosting & 0.93\% & 0.93\% \\ \hline KNeighborsClassifier & 0.85\% & 0.85\% \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Performance of machine learning models with all 25 features. the Gradient Boosting model, which performs quite well but falls slightly short compared to XGBoost. While it shares some similarities with XGBoost, its AUC score is somewhat lower, indicating that it may not optimize predictions as effectively. Lastly, Figure 6e presents the K-Nearest Neighbors (KNN) model. Although it has its merits, it struggles with lower performance, largely due to its sensitivity to the distribution of the data. This sensitivity means it can be significantly affected by how the data points are organized. Figure 6: ROC Curves for Decision Tree, Random Forest, XGBoost, Gradient Boosting, and K-Nearest Neighbors models; comparing classification performance across multiple classes: (**a**) ROC Curve for Decision Tree Model. (**b**) ROC Curve for Random Forest Model. (**c**) ROC Curve for XGBoost Model. (**d**) ROC Curve for Gradient Boosting Model. (**e**) ROC Curve for K-Nearest Neighbors Model. The findings suggest that ensemble methods like XGBoost and Random Forest are the clear winners in this comparison. They consistently outperform simpler models, providing more reliable classification results and better handling of complex datasets, making them excellent choices for achieving high accuracy in real-world applications. To ensure the practicality of deploying our proposed DDoS detection system in real-world Internet of Vehicles (IoV) environments, we conducted a detailed analysis of the energy consumption involved in running both Machine Learning (ML) and Federated Learning (FL) tasks. Given that IoV devices often operate under limited energy resources, understanding the power demands of these models is critical. In Table 6, after feature selection, our analysis revealed that complex ML models such as Random Forest and XGBoost could consume between 0.75 and 1.75 kWh over a 15-35 h period, whereas simpler models like Decision Trees require significantly less energy. When applied in an FL setting, energy consumption decreases further, with complex models using 0.417 to 1.25 kWh during federated rounds and simpler models consuming as little as 0.35 kWh over 7-20 h. The Gini index-based feature selection further improves energy efficiency, reducing computational load by 30%, which is particularly beneficial for resource-constrained IoV devices. This optimization makes our solution effective and energy-efficient, addressing both the scalability and sustainability challenges in real-world IoV systems. \begin{table}
\begin{tabular}{l l l l l} \hline \hline
**Task Type** & **Model Complexity** & **Models Used** & **Total Time (Hours)** & **Power Consumption (kWh)** \\ \hline \multirow{3}{*}{ML} & Simpler Models & Decision Tree, K-Neighbors & 5 to 15 & 0.25 to 0.75 \\  & & Classifier & & \\ \cline{2-5}  & Complex Models & Random Forest, XGBoost, & 15 to 35 & 0.75 to 1.75 \\  & & Gradient Boosting & & \\ \hline \multirow{3}{*}{FL} & Simpler Models & Decision Tree, K-Neighbors & 7 to 20 & 0.35 to 1.00 \\  & & Classifier & & \\ \cline{2-5}  & Complex Models & Random Forest, XGBoost, & 10 to 30 & 0.417 to 1.25 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Power consumption during machine learning and federated learning tasks.