Attention-Based Encoder for Online Data Anomaly Classification in Multivariate Time Series
Qun Yang, Xiao Yu, Yuguang Fu · Journal of Computing in Civil Engineering · 2025
Data collected from low-cost sensors in structural health monitoring (SHM) often contain anomalies, leading to misinterpretations of subsequent structural condition assessment. Therefore, the classification model is required to identify various data anomaly types before the raw sensor data are used for SHM applications. Existing machine learning models have achieved decent performance in overall accuracy, but the accuracy is not consistently high across different anomaly types, e.g., outliers and trends, due to their subtle unique features which are difficult to extract. In this study, an attention-based model for data anomaly classification is proposed to obtain uniformly high accuracy for various anomaly types. The proposed model first divides the original sensor data into windows, and then transforms the window data into histogram as embeddings, followed by the use of an attention mechanism to learn dependencies between windows. In addition, four synthetic data sets with single and combined anomaly types were generated by injecting anomalous data into the original data to assess the generalization capability across diverse data sets. Extensive experiments demonstrated that the proposed model outperforms the baselines by a great margin, achieving state-of-the-art performance across various data anomaly types. The proposed model achieved superior performance on one real and four synthetic data sets, demonstrating its generalization in real-world SHM applications. Compared with existing methods, the proposed model has a distinct advantage in explaining classification results by visualizing attention maps and features from the attention-based encoder.