# An Improved CNN Model for Within-Project Software Defect Prediction  
[PERSON]  
1 The Key Laboratory on Reliability and System Engineering, Beihang University, Beijing 100191, China  
1 Correspondence: [EMAIL_ADDRESS] (C.P. ); [EMAIL_ADDRESS] (M.L.) 1 The Key Laboratory on Reliability and System Engineering, Beihang University, Beijing 100191, China  
1 Correspondence: [EMAIL_ADDRESS] (C.P. ); [EMAIL_ADDRESS] (M.L.) 1 The Key Laboratory on Reliability and Environmental Engineering Technology, Beihang University, Beijing 100191, China; [EMAIL_ADDRESS] (B.  
defects and the other is utilizing existing statistics-based models or machine learning models and making improvements to existing models for better classification of buggy code. Alongside the first direction, researchers have designed various hand-crafted features to capture defect characteristics, for example, Halstead features [7] based on operator and operand counts, McCabe features [8] based on dependencies, and other comprehensive feature sets including Chidamber and Kemerer (CK) features [9], metrics for object-oriented design (MOOD) features [10], and code change features [11]. As for the second direction, many machine learning models have been designed to target software defect prediction, including the decision tree [12], random forest [13], logistic regression [14], naive Bayes [15], and dictionary learning [16] models. Unlike natural languages, programs have a well-defined syntax in the form of the Backus-Naur Form, which can be further organized into abstract syntax trees (ASTs) [17]. ASTs have been widely used for characterizing source code [18; 19]. However, program semantics is also buried deep in ASTs [20], however, it is ignored by traditional hand-crafted features. Researchers have shown the usefulness of ASTs in software engineering tasks such as code completion and bug detection [17; 18; 19; 21; 22]. In recent studies [23; 24], researchers have begun to extract features from ASTs to capture both syntax and semantics of source code, and these features have shown great improvements over traditional hand-crafted features. Since the advent of AlexNet [25] in 2012, deep learning has been widely used in areas such as image recognition, speech recognition, and natural language processing [26]. It has emerged as a powerful technique for automated feature generation since deep learning architecture can effectively capture highly complicated nonlinear features [26]. To make use of its powerful feature generation ability, the deep belief network (DBN) [23] was proposed. One year later, the state-of-the-art method [24] leveraging convolutional neural network (CNN) was proposed to learn the semantics of source code via AST programs, which have been shown to outperform traditional feature-based approaches in software defect prediction. However, whether the CNN model outperforms traditional machine learning models has remained unclear. First, the dataset used in the CNN study [24] was rather small. There were only 14 versions of seven projects, which likely added to the work's statistical uncertainty. Second, the results in the CNN paper were derived from insufficiently repeated experiments. As suggested by [PERSON] [27], to minimize statistical bias and variance, there should be no fewer than 30 repeated experiments, and research on model validation by [PERSON] [28] also supported that conclusion. The CNN study repeated the experiment only 10 times, a choice that undermined the confidence in their conclusions. Lastly, the researchers for the CNN study did not choose the proper traditional baseline. The traditional baseline [29] in the CNN study included only a logistic regression model for within-project defect prediction (WPDP) and this was not suitable, as no research indicates that logistic regression could achieve best performance for WPDP. For this study, we proposed an improved CNN model for software defect prediction to validate the hypothesis that CNN models can outperform traditional machine learning models for WPDP.