<p>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 (<InlineEquation ID="IEq1"> <EquationSource Format="TEX">\(\approx\)</EquationSource> </InlineEquation> 0.999). While MLP demonstrated competitive performance (high Micro-F1), it incurred a significantly higher training cost compared to the tree-based ensembles. Feature analysis identified complexity metrics (e.g., CRIX, WMC) as the most critical predictors for co-occurring smells. These findings provide practical guidance for selecting appropriate multi-label strategies. XGBoost emerges as the most robust and efficient option for complex code smell detection scenarios, offering a superior balance between accuracy and computational resources compared to both traditional machine learning and deep learning baselines.</p>

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

The Impact of Label Space Partitioning in Multi-label Code Smell Detection

  • Nguyen Thanh Binh,
  • Minh N. H. Nguyen,
  • Le Thi My Hanh,
  • Nguyen Thanh Binh

摘要

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 ( \(\approx\) 0.999). While MLP demonstrated competitive performance (high Micro-F1), it incurred a significantly higher training cost compared to the tree-based ensembles. Feature analysis identified complexity metrics (e.g., CRIX, WMC) as the most critical predictors for co-occurring smells. These findings provide practical guidance for selecting appropriate multi-label strategies. XGBoost emerges as the most robust and efficient option for complex code smell detection scenarios, offering a superior balance between accuracy and computational resources compared to both traditional machine learning and deep learning baselines.