# An Empirical Evaluation of Ensemble Models for Python Code Smell Detection
## 6 Conclusions  
This study proposed a Python-specific framework developed by [PERSON] et al. [3] for detecting method-level code smells, LC and LM, using five ensemble learning techniques combined with chi-square FST and SMOTE-based class balancing. Unlike most prior studies that focus on Java, this work explores the performance of ensemble classifiers in Python, a dynamically typed and indentation-structured language, posing unique analytical challenges. This study was guided by three research questions:  
**RQ1:**_Which ensemble algorithms perform best for detecting Python-specific code smells, considering structural and syntactic differences from Java?_  
The results show that the Max Voting model achieved the highest performance on the LC dataset (accuracy: 0.96, MCC: 0.85), while Bagging, Gradient Boost, and XGBoost performed best on the LM dataset (accuracy: 0.98, MCC: 0.94). These outcomes affirm the applicability of ensemble learning in the Python domain while also highlighting different behaviors across classifiers compared to Java-based studies. **RQ2:**_Does chi-square-FST improve model performance in Python code smell detection, given Python's unique metric distribution influenced by dynamic typing and indentation-based structure?_  
The application of chi-square FST led to consistent gains in performance, as it selected the most relevant structural and lexical code features. The selected features (e.g., Iloc, scloc, h1, n2) reflect Python-specific code properties and contribute to more robust classification outcomes. **RQ3:**_How does class imbalance in Python smell datasets influence model accuracy, and does SMOTE remain effective compared to its performance on Java datasets?_  
The Python datasets were highly imbalanced (20:80 class ratio). Applying SMOTE significantly improved minority class detection, particularly in terms of the recall and MCC scores, validating its effectiveness in the Python context. A paired _t_-test analysis confirmed the statistical significance of performance gains (_p_-values < 0.05 for top models), affirming the robustness of the proposed framework. A comprehensive comparison with the authors' earlier Java-based work is presented in Section 5.4 and Table 11, highlighting differences in language structure, dataset design, model behavior, and performance metrics. These insights validate that adapting feature selection, balancing methods, and ensemble configurations to language-specific contexts is crucial for accurate and meaningful code smell detection. This study provides valuable insights for both researchers and software practitioners. Accurate detection of Python code smells is fundamental to improving software quality and maintainability, reducing the risk of failure, and facilitating effective code refactoring. The ensemble learning-based methods presented here demonstrate high accuracy and robustness in identifying Python code smells. These techniques can be integrated into development workflows, such as code reviews or continuous integration pipelines, to identify and resolve code smells early, ultimately reducing technical debt. In addition to offering a practical framework for detecting Python code smells, this work emphasizes the importance of feature selection and class balancing techniques. By incorporating ensemble learning and chi-square FST, this study presents a comprehensive approach to enhancing code smell detection in Python, contributing to more efficient and reliable software development practices. Future work will involve expanding the scope to include additional types of code smells and evaluating the proposed approach on larger and more diverse datasets. Open-source repositories (e.g., GitHub, GitLab) and various Python projects will be leveraged to improve dataset diversity. These efforts aim to further assess the robustness and scalability of the proposed methods and explore their applicability to other programming languages.