DeleSmell: Code smell detection based on deep learning and latent semantic analysis

被引:18
作者
Zhang, Yang [1 ]
Ge, Chuyan [1 ]
Hong, Shuai [1 ]
Tian, Ruili [2 ]
Dong, Chunhao [3 ]
Liu, Jingjing [1 ]
机构
[1] Hebei Univ Sci & Technol, Sch Informat Sci & Engn, Shijiazhuang 050018, Hebei, Peoples R China
[2] China Unicom Corp, Shijiazhuang 050000, Hebei, Peoples R China
[3] Beijing Inst Technol, Sch Comp, Beijing 100081, Peoples R China
关键词
Code smell; Deep learning; Refactoring; Latent semantic analysis; CLASSIFIER; SEARCH;
D O I
10.1016/j.knosys.2022.109737
中图分类号
TP18 [人工智能理论];
学科分类号
081104 ; 0812 ; 0835 ; 1405 ;
摘要
The presence of code smells will increase the risk of failure, make software difficult to maintain, and introduce potential technique debt in the future. Although many deep-learning-based approaches have been proposed to detect code smells, most existing works suffer from the problem of incomplete feature extraction and unbalanced distribution between positive samples and negative samples. Furthermore, the accuracy of existing works can be further improved. This paper proposes a novel approach named DeleSmell to detect code smells based on a deep learning model. The dataset is built by extracting samples from 24 real-world projects. To improve the imbalance in the dataset, a refactoring tool is developed to automatically transform good source code into smelly code and to generate positive samples based on real cases. DeleSmell collects both structural features through iPlasma and semantic features via latent semantic analysis and word2vec. DeleSmell's model includes a convolutional neural network(CNN) branch and gate recurrent unit(GRU)-attention branch. The final classification is conducted by an support vector machine(SVM). In the experimentation, the effectiveness of DeleSmell is evaluated by answering seven research questions. The experimental results show that DeleSmell improves the accuracy of brain class (BC) and brain method (BM) code smells detection by up to 4.41% compared with existing approaches, demonstrating the effectiveness of our approach. (c) 2022 Elsevier B.V. All rights reserved.
引用
收藏
页数:12
相关论文
共 52 条
  • [1] Aaa B., 2021, INFORM SOFTWARE TECH, V138
  • [2] Improving support vector machine classifiers by modifying kernel functions
    Amari, S
    Wu, S
    [J]. NEURAL NETWORKS, 1999, 12 (06) : 783 - 789
  • [3] Amorim L, 2015, 2015 IEEE 26TH INTERNATIONAL SYMPOSIUM ON SOFTWARE RELIABILITY ENGINEERING (ISSRE), P261, DOI 10.1109/ISSRE.2015.7381819
  • [4] [Anonymous], 2005, IEEE INT C SOFTW MAI
  • [5] Bergstra J, 2012, J MACH LEARN RES, V13, P281
  • [6] Pseudo 2D hidden Markov models for face recognition using neural network coefficients
    Bevilacqua, Vitoantonio
    Cariello, Lucia
    Daleno, Domenico
    Mastronardi, Giuseppe
    [J]. 2007 IEEE WORKSHOP ON AUTOMATIC IDENTIFICATION ADVANCED TECHNOLOGIES, PROCEEDINGS, 2007, : 107 - +
  • [7] Bishop C. M., 2006, PATTERN RECOGN
  • [8] SMOTE: Synthetic minority over-sampling technique
    Chawla, Nitesh V.
    Bowyer, Kevin W.
    Hall, Lawrence O.
    Kegelmeyer, W. Philip
    [J]. 2002, American Association for Artificial Intelligence (16)
  • [9] Cho K., 2014, P C EMP METH NAT LAN, P1724
  • [10] Das AK, 2019, TENCON IEEE REGION, P2081, DOI [10.1109/TENCON.2019.8929628, 10.1109/tencon.2019.8929628]