## 4 Results and Discussion
### Fault Classification

Table 5: Fault classification performance metrics. predicted time steps, only the top three features, as determined previously, were calculated and sent to the first classifier for fault detection. Figure 14 depicts the fault detection performance in the form of confusion matrices obtained from the different classifiers. Table 6 lists values from the performance in the fault detection task. The table shows that every classifier can recognize the pattern of the prediction horizons for normal or fault classes with an accuracy of around 97%, except for the SVM classifier, which had a slightly lower accuracy at 96.64%. During fault type classification, a pattern similar to the previous case was observed. The classifiers could recognize the stuck fault successfully, but for bias and drift faults the classifiers were not very accurate, as demonstrated in the confusion matrices of Figure 15.  
The bar chart in Figure 16 shows the average values for precision, recall, F1-score, and accuracy from the five classifiers considered in this work. The last group of bars shows all the classifiers had above 93% accuracy in classifying the types of fault except for the SVM, which had an accuracy of 91% (about 2% less than the others). Although the average classification accuracy is quite promising, the confusion matrices of Figure 15 show the classifiers did not perform definitively with bias faults and drift faults. These misclassified instances could be reduced by considering multiple prediction horizons after detecting a fault in order to calculate features and then using the classifier. The improvement in classification when five prediction horizons are considered, rather than one, is visible in the confusion matrices in Figure 17. The improvement in fault classification is because when multiple prediction windows are considered, more time steps are enlisted for calculating features. Thus, it is possible to capture the distinct patterns in two types of faults. In the previous case, the associated features were computed for only 20 time steps, and the misclassified samples aligned with prediction windows where the sensor signal values for bias and drift faults exhibited similarity. Due to this,  
Figure 14: Fault detection performance for different classifiers with the WSN dataset: (**a**) random forest, (**b**) XGBoost, (**c**) SVM, (**d**) KNN, and (**e**) LightGBM  
the features calculated from those segments were not significantly different, and thus, wrongly classified. \begin{table}
\begin{tabular}{c c c c} \hline \hline  & **Random Forest** & \\ \hline  & **Normal** & **Faulty** & **Average** \\ \hline Precision & 96.98\% & 97.82\% & 97.40\% \\ Recall & 97.67\% & 97.18\% & 97.43\% \\ F1-score & 97.33\% & 97.50\% & 97.41\% \\ Accuracy & 97.42\% & 97.42\% & 97.42\% \\ \hline  & **XCBoost** & \\ \hline Precision & 97.29\% & 97.28\% & 97.28\% \\ Recall & 97.09\% & 97.46\% & 97.28\% \\ F1-score & 97.19\% & 97.37\% & 97.28\% \\ Accuracy & 97.28\% & 97.28\% & 97.28\% \\ \hline  & **SVM** & \\ \hline Precision & 96.18\% & 97.07\% & 96.62\% \\ Recall & 96.86\% & 96.43\% & 96.65\% \\ F1-score & 96.52\% & 96.75\% & 96.63\% \\ Accuracy & 96.64\% & 96.64\% & 96.64\% \\ \hline  & **KNN** & \\ \hline Precision & 96.98\% & 97.55\% & 97.26\% \\ Recall & 97.37\% & 97.18\% & 97.27\% \\ F1-score & 97.17\% & 97.27\% & 97.27\% \\ Accuracy & 97.27\% & 97.27\% & 97.27\% \\ \hline  & **LightGBM** & \\ \hline Precision & 96.77\% & 97.36\% & 97.07\% \\ Recall & 97.17\% & 96.99\% & 97.08\% \\ F1-score & 96.97\% & 97.18\% & 97.07\% \\ Accuracy & 97.08\% & 97.08\% & 97.08\% \\ \hline \hline  & **LightGBM** & \\ \hline Precision & 96.77\% & 97.36\% & 97.07\% \\ Recall & 97.17\% & 96.99\% & 97.08\% \\ F1-score & 96.97\% & 97.18\% & 97.07\% \\ Accuracy & 97.08\% & 97.08\% & 97.08\% \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Fault detection performance for the WSN dataset.