# An Empirical Evaluation of Ensemble Models for Python Code Smell Detection
## 5 Discussion
### Comparative Analysis of the Approach with the Authors' Previous Studies  
We acknowledge that some aspects of this research framework, such as the use of ensemble models, SMOTE, and chi-square FST, were previously explored in our Java-based code smell detection studies [6; 14; 24; 32; 35]. However, we emphasize that this study contributes novel insights by recontextualizing these techniques for Python-based code smells, which differ markedly from Java in structure, metrics, and coding patterns. The following Table 11 summarizes the distinct contributions of this study relative to our previous studies [6; 14; 24; 32; 35]:  
This table compares key elements, including language characteristics, code smell types, programming language focus, models used, feature selection strategies, contributions, and the novelty of each work. For clarity, we summarize the key distinctions below:  
**Programming Language Focus:** Our previous studies were primarily based on Java datasets (e.g., Fontana and Guggulothu datasets), while this is the first ensemble learning application of our framework to Python, a dynamically typed language with a different code structure and metric distribution than Java. **Dataset Structure and Code Smell Types:** Previous works addressed multiple smells or severity levels in Java datasets, whereas the current study focuses specifically on the binary classification of two Python code smells, LC and LM, curated from open-source libraries, which reflect real-world code issues in Python rather than Java. **Methodological Shift:** The previous study [35] employed the chi-square FST for multi-label code smell detection at the method level. In contrast, while this current study also uses chi-square, it does so in a different context, Python-based datasets with ensemble learning, not multi-label learning. In [32], the previous work used PCA-based feature selection to detect the severity of code smells, which differs both in methodological application and in problem scope, marking a methodological divergence aligned with the statistical properties of the Python datasets. **Ensemble Strategy Focus:** Previous works such as [32] focused on the severity classification of smells [14; 35], including ensemble models, but applied them to different problem settings such as severity prediction or multi-label classification. In contrast, this study concentrates on single-label binary classification using five ensemble methods (Bagging, Gradient Boost, Max Voting, AdaBoost, XGBoost) on Python code smells, which has not been explored in our previous work and is a relatively unexplored direction in the literature. **Class Balancing and Performance Evaluation:** While SMOTE was used in some earlier studies ([32]), our present work compares the impact of SMOTE in the context of Python datasets with ensemble classifiers and chi-square FST, showing performance enhancements over baseline ML methods. **Novelty and Contribution:** The proposed study demonstrates the effectiveness of ensemble learning techniques on Python code smell detection, supported by a rigorous evaluation involving chi-square FST and SMOTE for class balancing. Unlike prior publications focused on Java datasets, model comparison, or severity ranking, this study demonstrates the transferability and effectiveness of ensemble models from Java to Python, offering insights into language-specific challenges and detection patterns. This addresses a notable gap in the literature, where most code smell detection is Java-centric. Additionally, the datasets, features, and resulting model behaviors are entirely new, as evidenced by the distinct performance outcomes and confusion matrix analyses. This validates the importance of domain-specific evaluation even when using established methods. This study provides the first comprehensive evaluation of ensemble models for code smell detection in Python, addressing a notable gap in the quality software literature.