The project consisted of two parts: programming and data analysis. In the programming segment, key functions were implemented to construct and utilize classification trees and ensemble methods. During analysis, we apply these functions to a real-world dataset to extract insights and evaluate model performance.






Results and discussion

The Random Forest model outperformed the Single Classification Tree and Bagging models in terms of overall performance. This was in line with expectations, as Random Forest is an ensemble method that aggregates the results of multiple decision trees, each trained on a random subset of the data. This reduces variance and overfitting, leading to improved generalization and a stronger ability to balance precision and recall. While Bagging shows higher precision, its lower recall than Random Forest suggests it may not capture as many defect cases. To properly test if these differences in precision and recall are significant, an additional ANOVA and Tukey test would need to be done for these metrics.



In contrast, the Single Classification Tree model struggled to maintain a balance between precision and recall, missing a significant number of defect cases.



As seen in the figure below, we created a visualisation that shows the first splits in the single tree model. In the first leaf node NSM max, we see that software that has a low number of sub-modules, indicating the code is less complex, is reasonably classified as 'no bugs'. In the second leaf VG max, the majority of cases are classified as 'bugs'. This classification is also reasonable in line with the notion that complex software is more prone to error. The third leaf NBD sum classifies software with a moderate sum of block depth as containing bugs. This seems intuitive as well, considering that nesting code brings higher complexity. Lastly, the fourth leaf pre classifies the software as containing bugs when the number of pre-release bugs is relatively high (but ≤ 11.5). Overall, given the attributes involved, the classification rules seem reasonable and align with general expectations of software complexity.