## 3 Results for LSTM and 1-D CNN  
### Results for LSTM  
The performance of the long short-term memory (LSTM) model was evaluated using a confusion matrix, as shown in Figure 3.  
The rows of the matrix correspond to the true classes, while the columns correspond to the predicted classes. The diagonal elements represent the number of points for which the predicted label is equal to the true label, while the off-diagonal elements are those that are mislabeled by the classifier. From the confusion matrix, we can observe the following:  
* The class 'Green' was correctly predicted 15 times but was confused with 'Red' seven times and 'Yellow' three times;
* The class 'Yellow' had 14 correct predictions, with seven instances misclassified as 'Red' and four as 'Green';
* The class 'Red' showed the highest number of correct predictions at 23, with only one instance for each misclassified as 'Green' and 'Yellow'. In addition to the confusion matrix, a detailed statistical analysis was performed to evaluate the precision, sensitivity, specificity, F1 score, and overall accuracy of the LSTM model. These metrics are summarized in Table 4.  
Precision measures the model's accuracy in predicting positive instances for each class. The LSTM model shows high precision in identifying the 'Green' and 'Yellow' classes, with 75.00% and 77.77%, respectively, indicating a lower rate of false positives for these classes. The 'Red' class has a slightly lower precision of 62.16%, suggesting more false positives in comparison. Sensitivity, or recall, reflects the model's ability to correctly identify true positives. The 'Red' class has a notably high sensitivity at 92.00%, showing that the LSTM model is particularly effective at identifying 'Red' instances. However, the 'Green' and 'Yellow' classes have lower sensitivity rates of 60.00% and 56.00%, respectively, which indicates that the model misses a fair number of actual positive instances for these classes. Specificity measures the model's ability to correctly identify true negatives. The 'Yellow' class exhibits the highest specificity at 92.00%, followed closely by 'Green' with 90.00%, suggesting that the model is generally reliable in recognizing instances that are not of these classes. The 'Red' class, however, has a lower specificity of 72.00%, pointing towards a higher rate of false negatives. The F1 Score provides a balance between precision and sensitivity. A high F1 Score for the 'Red' class at 74.19% suggests a balanced performance between precision and \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Class** & **Precision** & **Sensitivity** & **Specificity** & **F1 Score** & **Accuracy** \\ \hline Green & 75.00\% & 60.00\% & 90.00\% & 66.66\% & 80.00\% \\ Yellow & 77.77\% & 56.00\% & 92.00\% & 65.11\% & 80.00\% \\ Red & 62.16\% & 92.00\% & 72.00\% & 74.19\% & 78.66\% \\ \hline Overall & & & & & 69.33\% \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Performance metrics of LSTM. Figure 3: Confusion matrix for the LSTM classification. sensitivity, despite the lower precision for this class. 'Green' and 'Yellow' classes have F1 Scores of 66.66% and 65.11%, respectively, indicating room for improvement in balancing the precision and sensitivity for these classes. The overall accuracy of the model stands at 69.33%, which considers the correct predictions made over all classes. While this indicates generally acceptable performance, the variation across different classes suggests that the model's performance is not uniform and could be optimized further, especially for the 'Green' and 'Yellow' classes. In conclusion, the LSTM model demonstrates a strong ability to identify the 'Red' class with high sensitivity but shows variability in performance across other classes. Figure 4 shows the training and validation accuracy and loss of the LSTM model during the training process. In the top graph, the blue line represents the training accuracy, while the red line denotes the validation accuracy.