| Literature DB >> 34901421 |
Ahmed Bahaa Farid1,2, Enas Mohamed Fathy1, Ahmed Sharaf Eldin1,3, Laila A Abd-Elmegid1.
Abstract
In recent years, the software industry has invested substantial effort to improve software quality in organizations. Applying proactive software defect prediction will help developers and white box testers to find the defects earlier, and this will reduce the time and effort. Traditional software defect prediction models concentrate on traditional features of source code including code complexity, lines of code, etc. However, these features fail to extract the semantics of source code. In this research, we propose a hybrid model that is called CBIL. CBIL can predict the defective areas of source code. It extracts Abstract Syntax Tree (AST) tokens as vectors from source code. Mapping and word embedding turn integer vectors into dense vectors. Then, Convolutional Neural Network (CNN) extracts the semantics of AST tokens. After that, Bidirectional Long Short-Term Memory (Bi-LSTM) keeps key features and ignores other features in order to enhance the accuracy of software defect prediction. The proposed model CBIL is evaluated on a sample of seven open-source Java projects of the PROMISE dataset. CBIL is evaluated by applying the following evaluation metrics: F-measure and area under the curve (AUC). The results display that CBIL model improves the average of F-measure by 25% compared to CNN, as CNN accomplishes the top performance among the selected baseline models. In average of AUC, CBIL model improves AUC by 18% compared to Recurrent Neural Network (RNN), as RNN accomplishes the top performance among the selected baseline models used in the experiments. ©2021 Farid et al.Entities:
Keywords: Abstract syntax tree; Bidirectional long short-term memory; Convolutional neural network; Deep learning; Machine learning; Software defect prediction; Defect
Year: 2021 PMID: 34901421 PMCID: PMC8627227 DOI: 10.7717/peerj-cs.739
Source DB: PubMed Journal: PeerJ Comput Sci ISSN: 2376-5992
Figure 1Two examples of clean and defective code.
Figure 2Software defect prediction process.
Figure 3CNN architecture.
Figure 4Framework of LSTM units.
Figure 5Overview of CBIL model.
Figure 6Selected AST nodes.
Figure 7CBIL layers.
Description of the PROMISE dataset.
| Project | Releases | Total files | Defect’s rate (%) |
|---|---|---|---|
| Camel | 1.4, 1.6 | 1837 | 18.13 |
| Jedit | 4.0, 4.1 | 618 | 24.92 |
| Lucene | 2.0, 2.2 | 442 | 53.17 |
| Poi | 2.5, 3.0 | 827 | 63.97 |
| Synapse | 1.1, 1.2 | 479 | 30.48 |
| Xalan | 2.5, 2.6 | 1688 | 47.27 |
| Xerces | 1.2, 1.3 | 893 | 15.68 |
Traditional features used in the PROMISE dataset.
| Traditional features | |
|---|---|
| Weighted methods per class | Lines of code |
| Depth of inheritance tree | Response for a class |
| Number of children | Data access metric |
| Coupling between object classes | Measure of aggregation |
| Measure of function abstraction | Afferent coupling |
| Lack of cohesion in methods | Efferent coupling |
| Cohesion among methods of a class | Inheritance coupling |
| Lack of cohesion in methods3 | Average method complexity |
| Number of public methods | Coupling between methods |
| Maximum McCabe | Average McCabe |
F-measure of CBIL and baseline models.
| Project | RF | DBN | CNN | RNN | CBIL |
|---|---|---|---|---|---|
| Camel | 0.396 | 0.335 | 0.505 | 0.515 |
|
| Jedit | 0.550 | 0.480 | 0.631 | 0.595 |
|
| Lucene | 0.604 | 0.758 |
| 0.672 | 0.744 |
| Poi | 0.669 | 0.780 | 0.778 | 0.722 |
|
| Synapse | 0.414 | 0.503 | 0.512 | 0.487 |
|
| Xalan | 0.638 | 0.681 | 0.676 | 0.606 |
|
| Xerces | 0.185 | 0.261 | 0.311 | 0.262 |
|
| Average | 0.494 | 0.543 | 0.596 | 0.551 | 0.848 |
AUC of CBIL and baseline models.
| Project | RF | DBN | CNN | RNN | CBIL |
|---|---|---|---|---|---|
| Camel | 0.677 | 0.654 | 0.732 | 0.766 |
|
| Jedit | 0.797 | 0.794 | 0.841 | 0.842 |
|
| Lucene | 0.641 | 0.682 | 0.688 | 0.693 |
|
| Poi | 0.636 | 0.668 | 0.745 | 0.764 |
|
| Synapse | 0.682 | 0.657 | 0.632 | 0.648 |
|
| Xalan | 0.674 | 0.676 | 0.674 | 0.654 |
|
| Xerces | 0.576 | 0.560 | 0.671 | 0.730 |
|
| Average | 0.669 | 0.670 | 0.712 | 0.728 | 0.908 |
Figure 8F-measure of CBIL under LSTM units.
Figure 10F-measure of CBIL under filters.
Figure 11Performance of CBIL for WPDP.
Sample of PROMISE dataset for CPDP.
| Source project | Target project |
|---|---|
| Camel 1.4 | Jedit 4.0 |
| Jedit 4.0 | Lucene 2.2 |
| Lucene 2.0 | Poi 3.0 |
| Poi 2.5 | Synapse 1.2 |
| Synapse 1.1 | Xalan 2.6 |
| Xalan 2.5 | Xerces 1.3 |
| Xerces 1.2 | Camel 1.6 |
Figure 12Performance of CBIL for CPDP.