## 4 Empirical Study
### Ensemble Models Construction and Validation  
In this experiment, the dataset was partitioned into two groups: 10% of the dataset used in hyperparameter tuning (tuning dataset) and 90% used for training and testing ensemble models (training/testing dataset). Seven tree-based ensemble models, including random forest (RF), extra trees (ET), AdaBoost (Ada), gradient boosting (GB), histogram-based gradient boosting (HGB), XGBoost (XGB) and CatBoost (CAT), and one stacking ensemble model, were constructed. For each tree-based ensemble, two models were trained and tested, one using the optimal hyperparameter values obtained by the optimization algorithm and one using the default hyperparameters. We constructed the stacking ensemble utilizing the tuned tree-based ensemble models as base models and the logistic regression as a meta model. In this study, we used Python to implement our machine learning pipeline using the scikit-learn framework [45]. \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline \multirow{2}{*}{**Authors**} & \multirow{2}{*}{**Dataset Name**} & \multirow{2}{*}{
\begin{tabular}{c} **Ind.** \\ **Variables** \\ \end{tabular} } & \multirow{2}{*}{**Defective**} & \multicolumn{2}{c}{**Non-**} & \multirow{2}{*}{**Instances**} & \multirow{2}{*}{**EPV**} & \multirow{2}{*}{**Defective \%**} & \multirow{2}{*}{**Granularity**} \\ \cline{3-3} \cline{6-9}  & JM1 & 21 & 1672 & 6110 & 7782 & 79.6 & 21\% & Method \\ [PERSON] et al. [34] & KC1 & 21 & 314 & 869 & 1183 & 15.0 & 27\% & Method \\  & PC5 & 38 & 471 & 1240 & 1711 & 12.4 & 28\% & Method \\ \hline \multirow{3}{*}{[PERSON] et al. [35]} & Eclipse JDT Core & 15 & 206 & 791 & 997 & 13.7 & 21\% & Class \\  & Eclipse PDE UI & 15 & 209 & 1288 & 1497 & 13.9 & 14\% & Class \\  & Mylyn & 15 & 245 & 1617 & 1862 & 16.3 & 13\% & Class \\ \hline \multirow{7}{*}{[PERSON] et al. [36]} & camel 1.2 & 20 & 216 & 549 & 765 & 10.8 & 28\% & Class \\  & lucene 2.4 & 20 & 203 & 333 & 536 & 10.2 & 38\% & Class \\  & prop-1 & 20 & 2436 & 20,622 & 23,058 & 121.8 & 11\% & Class \\  & prop-2 & 20 & 1514 & 11,645 & 13,159 & 75.7 & 12\% & Class \\  & prop-3 & 20 & 840 & 8027 & 8867 & 42.0 & 9\% & Class \\  & prop-4 & 20 & 1299 & 7274 & 8573 & 65.0 & 15\% & Class \\  & prop-43 & 20 & 341 & 11,338 & 11,679 & 17.1 & 3\% & Class \\  & prop-5 & 20 & 2720 & 17,686 & 20,406 & 136.0 & 13\% & Class \\  & xalan 2.5.0 & 20 & 387 & 558 & 945 & 19.4 & 41\% & Class \\  & xalan 2.6.0 & 20 & 411 & 759 & 1170 & 20.6 & 35\% & Class \\ \hline \multirow{3}{*}{[PERSON] et al. [38]} & Eclipse 2.0 & 31 & 2610 & 4119 & 6729 & 84.2 & 39\% & File \\  & Eclipse 2.1 & 31 & 2139 & 5749 & 7888 & 69.0 & 27\% & File \\  & Eclipse 3.0 & 31 & 2913 & 7680 & 10,593 & 94.0 & 27\% & File \\ \hline \multirow{3}{*}{[PERSON] et al. [39]} & SWT & 17 & 653 & 832 & 1485 & 38.4 & 44\% & File \\  & Debug & 17 & 263 & 802 & 1065 & 15.5 & 25\% & File \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Software defect datasets used in the experiment. Prior to building the ensemble model, two pre-processing steps were performed: data transformation and missing value handling:  
* Data transformation. Data transformation is recommended to boost the performances of machine learning models [46]. Therefore, we used a logarithmic data transformation where each value of the independent variables was transformed using \(x=\log(1+x)\), where \(x\) is the numerical value of the variable. We selected the log transformation because it has been used previously in software defect prediction [30,46]. * Handling missing values. Missing data can be handled in a variety of ways, including mean imputation, deletion and median imputation [47]. For all datasets, we utilized the mean imputation approach to deal with missing values. The mean of all values belonging to the independent variable was used to fill in the missing values. It is one of the most often used approaches and has been proved to yield good results in supervised learning tasks [48].