# CL-TAD: A Contrastive-Learning-Based Method for Time Series Anomaly Detection
## 5 Conclusions  
The time series anomaly detection task has recently gained increasing attention in diverse sectors including manufacturing, banking, and healthcare. In this paper, we introduced CL-TAD, a novel contrastive-learning-based method for time series anomaly detection. In our method, we augment the normal data with a combination of a masking technique and a TCN-based encoder-decoder module. Subsequently, a representation generation network is trained using a contrastive learning technique for both the original normal samples and the augmented samples. The training process relies solely on normal time series data without any anomaly events. This characteristic is particularly beneficial for anomaly detection, with the challenges associated with collecting datasets rich in anomalies. For the determination of anomaly score thresholds, we deploy an approach that searches for the value that maximizes the \(F_{1}\) score for a designated held-out dataset. The CL-TAD is potentially quite useful in industries such as manufacturing, finance, and healthcare for which it is time-consuming and expensive to label training time series data because the CL-TAD does not require labeled data. To evaluate the performance of our method, we applied it to the nine well-known benchmark datasets. It outperformed other approaches in five out of the nine benchmarks in terms of \(F_{1}\) performance. In the experiments, the CL-TAD achieved excellent performances on univariate time series data as well as multivariate time series data of which the number of dimensions is not high. The experiments showed that the effective representation could be found for time series data anomaly detection by the proposed method only with normal data. It is practically useful in practical applications for which it is hard to obtain labeled training data. The reliance on normal data during the training phase renders our approach highly applicable to situations with a scarcity of labeled data. Moreover, our empirical evaluations demonstrated that CL-TAD maintained its robust performance even with limited training data. This means that CL-TAD can be used as a valuable tool for time series anomaly detection, showcasing its potential to address real-world challenges effectively. Figure 16: Performance of our model on 2D-Gesture and PSM benchmarks with different encoders. \begin{table}
\begin{tabular}{c c c c c} \hline \hline \multirow{2}{*}{**Encoder Module**} & \multirow{2}{*}{**Dataset**} & \multicolumn{3}{c}{**Performance**} \\ \cline{3-5}  & & **Precision** & **Recall** & \(\mathbf{F_{1}}\) \\ \hline \multirow{2}{*}{6 Layer 1D-CNN} & 2D-Gesture & 100 & 99.59 & 99.79 \\ \cline{2-5}  & PSM & 84.64 & 84.71 & 84.68 \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Performance of our model with a six-Layer 1D-CNN used in Encoders on 2D-Gesture and PSM benchmark datasets. **Author Contributions:** Conceptualization, H.C.V.N. and K.M.-L.; methodology, H.C.V.N. ; software, H.C.V.N. ; validation, H.C.V.N. and K.M.-L.; formal analysis, K.M.L. ; investigation, K.M.-L.; resources, K.M.L. ; data curation, H.C.V.N. ; writing--original draft preparation, H.C.V.N. ; writing--review and editing, K.M.-L.; visualization, H.C.V.N. ; supervision, K.M.-L.; project administration, K.M.-L.; funding acquisition, K.M.-L. All authors have read and agreed to the published version of the manuscript. **Funding:** This work was supported by the National Research Foundation of Korea (NRF) grant funded by the Korea government (MSIT) (No. 2022R1A5A8026986) and the MSIT (Ministry of Science and ICT), Korea, under the Grand Information Technology Research Center support program (IITP-2023-2020-0-01462) supervised by the IITP (Institute for Information & communications Technology Planning & Evaluation). **Informed Consent Statement:** Not applicable.