# Deep Learning for Anomaly Detection in CNC Machine Vibration Data: A RoughLSTM-Based Approach
## 4 Experimental Results and Discussion
### Performance Analysis  
This section presents a comprehensive performance analysis of the proposed RoughLSTM model, compared with the conventional LSTM model. In this study, anomaly detection was conducted using vibration data obtained from industrial CNC machines. The dataset consists of vibration data collected under real production conditions from three different CNC machines (MO1, MO2, and MO3) over a two-year period. The experimental studies were conducted on both RoughLSTM and LSTM models based on predefined hyperparameters. The performance of these models was evaluated using key metrics such as accuracy, loss, and the ROC curve. The primary objective of these experiments is to demonstrate the effectiveness of RoughLSTM in anomaly detection compared to the conventional LSTM model and to assess its applicability in industrial settings. Within the scope of the experimental analysis, different operational scenarios were considered. Initially, four different operation (option) scenarios were randomly selected for each CNC machine. For instance, for the M01 machine, vibration data from OP02, OP05, OP08, OP11, and OP14 operations were combined to conduct anomaly detection analysis. The performance metrics obtained from these analyses are presented in the form of tables and graphical representations. In addition, the vibration data of OP02, OP05, OP08, OP11, and OP14 operations of the M01 machine are shown in Figure 4.  
Figure 4: Time series representation of vibration data of OP02, OP05, OP08, OP11, and OP14 operations of M01 machine. Figure 5: Learning Curves of (**a**) LSTM and (**b**) RoughLSTM. Figure 6: Comparison of confusion matrix and performance matrices for LSTM (**a**) and RoughLSTM (**b**) models using OP02, OP05, OP08, OP11, and OP14 operations of M01 machine. Panels (a) and (b) in Figure 5 show the learning curves of the LSTM and RoughLSTM models, respectively. In the figure, training and validation processes are analyzed through accuracy and loss metrics. In Figure 5, examining the learning curves of LSTM and RoughLSTM models, significant performance differences are observed between the two models. The learning curve of the LSTM model (Figure 5a) shows rapid accuracy improvement within approximately 200 iterations (1 epoch) before stabilizing. This quick convergence indicates early learning by the model but suggests it remains at a lower accuracy level. Although the loss value in the LSTM model decreases over time, the observed fluctuations indicate that the model carries a risk of overfitting and has not reached sufficient learning capacity. While the LSTM model, which shows high variance initially, becomes relatively stable after certain iterations, the fluctuations in validation accuracy indicate that the model struggles to generalize to test data. Figure 7: Comparison of ROC curves for LSTM (**a**) and RoughLSTM (**b**) models using OP02, OP05, OP08, OP11, and OP14 operations of M01 machine. In contrast, the learning curve of the RoughLSTM model (Figure 5b) shows continuous improvement over approximately 2500 iterations (4 epochs). This extended learning period proves that the model absorbs more information and demonstrates better generalization. The accuracy values of the RoughLSTM model show more stable improvement throughout the training process compared to LSTM and exhibit fewer fluctuations. The model's rapid adaptation ability is particularly noteworthy in the shaded areas (Epochs 2, 3, and 4). The rapid decrease in training loss and controlled decline in validation loss demonstrate that the RoughLSTM model learns more efficiently and exhibits stronger generalization performance. The steady progression of validation accuracy indicates that the model can produce more reliable results in practical applications. When Table 3 is examined, RoughLSTM is seen to outperform LSTM in training and validation by about 4-6%. This difference indicates that the generalization ability of the model is stronger. RoughLSTM offers lower losses in both the training and validation phase.