## 4 Results and Discussion
### Machine Learning Models
However, the precision for D2 is significantly lower at 84% and D3 has a PPV of 94.3%, which is indicative of the impact of misclassifications. The false discovery rate (FDR) for D2 is the highest at 16%, indicating that the model faces greater challenges with this class. In comparison, D3 has an FDR of 5.7%. Overall, the SVM model demonstrates excellent performance, particularly for specific classes. However, further enhancements could be made to D2 to minimise misclassification and improve precision. A comparison of the results of the confusion matrices for each model demonstrates a high overall performance, although there are differences in the precision and misclassification rates for specific classes. The BT model demonstrates optimal performance for classes D5 and D1, exhibiting high precision. However, it exhibits suboptimal performance for class D2, with the highest rate of misclassification. The neural network model also demonstrates robust performance, particularly for classes D3 and D5. However, it faces challenges with class D6, which presents the highest misclassification rate. In contrast, the SVM model shows excellent precision for classes D1, D4, D5, and D6, with 100% correct classifications for these classes. However, it significantly underperforms with class D2, showing the highest misclassification rate (16%). In general, all three models perform well in most classes. However, the SVM model demonstrates exceptional accuracy for some classes, while the NN and BT models would benefit from further optimisation for classes D6 and D2, respectively. Table 3 presents a comparison of the three models (BT, NN, and SVM) based on their performance in classifying different types of defects (D1 to D6). The table includes accuracy information for each model, expressed as the true positive rate (TPR), and notes any classification problems (False Discovery Rate, FDR). A comparison of these three models allows for the identification of the strengths and weaknesses of each in the classification of defect types D1 to D6. SVM achieves perfect accuracy (100% TPR) for D1, D4, D5, and D6, establishing it as the optimal choice for these defects. The neural network shows superior performance in identifying D3 (97.4% TPR) and exhibits satisfactory results for D5 and D2. However, it exhibits some degree of misclassification for D1 and D6. The bagged tree model exhibits balanced performance across all defects, with notable results for D5 (97.2% TPR) and high precision for D3, D4, and D6. This makes it suitable for general classification without focussing on any specific defect type. In addition to the confusion matrices, the performance of the developed models was further evaluated using Receiver Operating Characteristic (ROC) curves and the corresponding Area Under the Curve (AUC) metrics. The ROC curve is a visual representation that demonstrates a classifier's capacity to differentiate between classes. It is constructed by plotting the true positive rate (TPR) against the false positive rate (FPR) at varying threshold levels. This enables a comprehensive analysis of the trade-off between sensitivity (recall) and specificity at varying decision thresholds. The AUC metric serves to complement the ROC curve by providing a single numeric value that can summarise the model's overall discriminatory ability. An AUC value approaching 1 indicates optimal performance, which indicates that the model is highly capable of distinguishing between the positive and negative classes. On the contrary, an AUC value of approximately 0.5 indicates that the model performance is no more accurate than random guessing. Therefore, the ROC-AUC analysis offers a more comprehensive evaluation of the robustness and effectiveness of the model across various classification thresholds (as illustrated in Figure 6), facilitating a more nuanced understanding of the model's generalisation capabilities beyond mere accuracy metrics.