# CL-TAD: A Contrastive-Learning-Based Method for Time Series Anomaly Detection
## 4 Experiments and Discussions
### The Implemented Model Architecture and Its Training  
For anomaly detection on the benchmark datasets, we implemented a deep neural network model corresponding to the architecture shown in Figure 6. The reconstruction module \(\Phi\) comprises an encoder, built using a six-layer TCN (temporal convolution network), and a decoder realized with a linear layer. For the representation learning component, the transformation module \(\Psi\) was implemented with a linear layer. In contrast, the encoder of the encoder module \(\Omega\) was implemented with a six-layer TCN, and the projector was realized with a two-layer fully connected network.  
Table 2 presents the hyperparameter values used in the experiments. For the training of our designed network model, we employed the Adam [60] optimizer with the LARS wrapper [61]. To adjust the learning rate, we utilized the cosine annealing technique with a linear warmup of 10 epochs, starting with a learning rate of \(10^{-3}\). Furthermore, the hyperparameter \(\tau\) was set to 0.05. The entire model was implemented using Pytorch 2.0.1 and executed on an NVIDIA Geforce RTX 2080 Ti GPU.  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multicolumn{2}{c}{**Dataset**} & **\#Dimension** & **\#Train** & **\#Test** & **Anomaly (\%)** \\ \hline \multicolumn{2}{c}{Power demand} & 1 & 18,145 & 14,786 & 10.39\% \\ \hline \multirow{4}{*}{UCR} & 135\_ & 1 & 1200 & 6301 & 0.19\% \\ \cline{2-6}  & 136\_ & 1 & 1600 & 5900 & 1.88 \\ \cline{2-6}  & 137\_ & 1 & 2300 & 5200 & 1.96 \\ \cline{2-6}  & 138\_ & 1 & 3000 & 4500 & 0.22 \\ \hline \multirow{4}{*}{ECG} & chfdb\_chf01\_275 & \multirow{4}{*}{2} & \multirow{4}{*}{1833} & \multirow{4}{*}{1841} & \multirow{4}{*}{14.61\%} \\  & (ECG-A) & & & & \\ \cline{2-6}  & chfdb\_chf13\_45590 & \multirow{4}{*}{2} & \multirow{4}{*}{2439} & \multirow{4}{*}{1287} & \multirow{4}{*}{12.35\%} \\  & (ECG-B) & & & & \\ \cline{2-6}  & chfdbchf15 & \multirow{4}{*}{2} & \multirow{4}{*}{10,863} & \multirow{4}{*}{3348} & \multirow{4}{*}{4.45\%} \\  & (ECG-C) & & & & \\ \cline{2-6}  & lstdb\_20221\_43 & \multirow{4}{*}{2} & \multirow{4}{*}{2610} & \multirow{4}{*}{1121} & \multirow{4}{*}{11.51\%} \\  & (ECG-D) & & & & \\ \cline{2-6}  & lstdb\_20321\_240 & \multirow{4}{*}{2} & \multirow{4}{*}{2011} & \multirow{4}{*}{1447} & \multirow{4}{*}{9.61\%} \\  & (ECG-E) & & & & \\ \cline{2-6}  & mitdb\_100\_180 & \multirow{4}{*}{2} & \multirow{4}{*}{2943} & \multirow{4}{*}{2255} & \multirow{4}{*}{8.38\%} \\  & (ECG-F) & & & & \\ \hline \multicolumn{2}{c}{2D-Gesture} & 2 & 8251 & 3000 & 24.63\% \\ \hline \multicolumn{2}{c}{PSM} & 25 & 132,481 & 87,841 & 27.76\% \\ \hline \multirow{4}{*}{SMD} & machine1-1 & 38 & 28,479 & 27479 & 9.36\% \\ \cline{2-6}  & machine2-1 & 38 & 23,693 & 23,694 & 4.94\% \\ \cline{2-6}  & machine3-2 & 38 & 23,702 & 23,703 & 4.66\% \\ \cline{2-6}  & machine3-7 & 38 & 28,705 & 28,705 & 1.51\% \\ \hline MSL & C-2 & 55 & 764 & 2051 & 6.58\% \\ \hline \multicolumn{2}{c}{SWaT} & 51 & 495,000 & 449,919 & 12.14\% \\ \hline \multicolumn{2}{c}{WADI} & 127 & 1,209,601 & 172,801 & 5.7\% \\ \hline \hline \end{tabular}
\end{table}
Table 1: Statistics of the datasets used for evaluation.