The Impact of Label Space Partitioning in Multi-label Code Smell Detection
摘要
Code smell appearance in sub-optimal design or implementation is a significant detractor of software quality. However, code smell detection is complicated by their frequent co-occurrence within the same code elements. Multi-label classification (MLC) offers a suitable paradigm for this challenge by allowing instances to be associated with multiple smell types, thereby capturing inter-label correlations. This paper empirically investigates the performance of Problem Transformation methods (PTMs) for MLC, combined with four base classifier algorithms: Decision Tree, Random Forest, XGBoost, and Multi-Layer Perceptron (MLP) as a deep learning baseline, for detecting code smells, with the impact of Label Space Partitioning (LSP). We evaluated these approaches on a multi-label dataset. LSP involved partitioning training data based on the number of labels per instance (1-label, 2-label, full-label). Performance was assessed using Training time, Hamming Loss, Macro-F1, Micro-F1 and Subset Accuracy. Furthermore, we conducted a feature importance analysis to improve model interpretability. Label Powerset is the most computationally efficient Problem Transformation method, particularly for MLP model. XGBoost consistently delivered superior predictive accuracy over Random Forest and MLP, achieving outstanding performance across all partitions with a near-perfect Subset Accuracy (