# An Empirical Evaluation of Ensemble Models for Python Code Smell Detection
## 4 Result Analysis
### Results for LM Dataset  
Table 5 presents the results obtained from applying chi-square FST and SMOTE. The gradient Boost method attained the highest accuracy score of 0.9845, an F-measure score of 0.98, and an MCC score of 0.94, underscoring its effectiveness. These scores reflect Gradient Boost's ability to accurately classify data with a strong balance between precision and recall (as indicated by the high F-measure), making it a highly reliable and efficient choice for the LM dataset. Conversely, while still effective, the AdaBoost model acquired the lowest accuracy and F-measure score of 0.96. Although 0.96 is a good performance, the fact that it is described as the lowest suggests that AdaBoost is comparatively less effective than Gradient Boost, but it remains a strong model overall. Figure 4 visually compares these methods for an LM dataset.  
Table 6 reveals the results without applying chi-square FST and SMOTE. The Bagging method proved the most effective, achieving a high accuracy score, an F-measure score of 0.98, and an MCC score of 0.9187. While the performance remains high, the slight drop in MCC score compared to Table 5 indicates that feature selection and SMOTE contribute to improved classification stability and minority class detection.  
\begin{table}
\begin{tabular}{l l l l l l l} \hline \hline
**Ensemble Learning** & **Accuracy** & **Precision** & **Recall** & **F-Measure** & **Cohen\_Kappa** & **MCC** \\ \hline
**Bagging** & **0.95** & **0.95** & **0.95** & **0.95** & **0.8268** & **0.8272** \\ \hline Gradient Boost & 0.92 & 0.92 & 0.92 & 0.92 & 0.74 & 0.7418 \\ \hline Max voting & 0.94 & 0.95 & 0.94 & 0.94 & 0.8182 & 0.8234 \\ \hline AdaBoost & 0.93 & 0.93 & 0.93 & 0.93 & 0.7586 & 0.7802 \\ \hline XGBoost & 0.92 & 0.92 & 0.92 & 0.92 & 0.8001 & 0.8032 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Performance Results of LC Dataset without Applied Chi-Square FST and SMOTE. Bold values indicate the highest performance achieved among the ensemble methods.  
The following results are observed from Tables 5 and 6:  
For the LM dataset, the Gradient Boost model obtained better results with FST and SMOTE, making it the most suitable model among other ensemble models (Table 5) because it merges the predictions of several weak learners to build a single, more accurate, strong learner. On the other hand, in the absence of FST and SMOTE, the Bagging model proves its adaptability and works well. However, it is important to note that feature selection and class balancing can further improve the model's overall consistency and dependability.  
The effectiveness of FST in enhancing ensemble model accuracy is evident in the comparative improvements across most methods. SMOTE improves recall and MCC and ensures a more balanced detection of smelly and non-smelly code instances.  
**RQ.1 Answer:** To answer RQ1, it was observed that the Max Voting performed best for the LC dataset, while Gradient Boost excelled on the LM dataset. These results suggest that no single ensemble model is universally optimal; instead, model effectiveness varies  
\begin{table}
\begin{tabular}{l c c c c c c} \hline \hline
**Ensemble Learning** & **Accuracy** & **Precision** & **Recall** & **F-Measure** & **Cohen\_Kappa** & **MCC** \\ \hline
**Bagging** & **0.98** & **0.98** & **0.98** & **0.98** & **0.9154** & **0.9187** \\ \hline Gradient Boost & 0.96 & 0.96 & 0.96 & 0.96 & 89.20 & 89.22 \\ \hline Max voting & 0.97 & 0.97 & 0.97 & 0.97 & 0.9122 & 0.9198 \\ \hline AdaBoost & 0.94 & 0.95 & 0.95 & 0.94 & 0.8472 & 0.8476 \\ \hline XGBost & 0.97 & 0.97 & 0.98 & 0.97 & 0.8936 & 0.8941 \\ \hline \hline \end{tabular}
\end{table}
Table 6: Performance Results of LM Dataset without Applied Chi-Square FST and SMOTE. Bold values indicate the highest performance achieved among the ensemble methods.  
Figure 4: Result comparison among five ensemble methods for LM dataset.  
with dataset characteristics. Compared to earlier Java-based studies, the adapted ensemble methods retained strong performance, validating their transferability.