## 2 Materials and Methods
### The Proposed Method
#### 2.2.2 DAB-minimize Contrasting Learning
In contrast, DABaCLT takes into account the raw \(N\) samples and feeds them into the encoder

Figure 3: The definition of constructing positive pairs and negative pairs. The color represents augmentation type (scale, temporal, or no augmentation), and the shape represents the different samples. Figure 2: The architecture of DABaCLT. The encoder, attention, and projector blocks in the raw features stream (RFS) share weights with the corresponding blocks in the DAB features stream (DABFS). The DABa-TC and DABa-CC modules learn temporal and contextual features and minimize the DAB with DABMinLoss, which includes \(L_{TC}^{s}\), \(L_{TC}^{t}\), \(L_{CC}^{s}\), \(L_{CC}^{t}\), and \(L_{CC}^{st}\). concurrently with the augmented samples. Similarity-based techniques have been applied in various time series classification tasks and other applications [27; 28]. In the contrasting module, assessing the similarity between the temporal- and scale-augmented samples is crucial for learning discriminative representations. To maximize the similarity of positive pairs and minimize the similarity of negative pairs, the loss function \(L_{\text{CC}}^{\text{sup}}\) is defined as follows:

\[L_{\text{CC}}^{\text{st}}=-\sum_{i=1}^{N_{b}}log\frac{exp(\text{sim}((p_{i}^{ \text{s}},p_{i}^{\text{t}})/\tau)}{\sum_{k\
eq i,a\in\{s,t\}}exp(\text{sim}((p_{ i}^{\text{s}},p_{k}^{\text{a}})/\tau)} \tag{3}\]

The \(\text{sim}(u,v)=u^{\text{T}}v/\|u\|\|v\|\) denotes the dot product between \(\mathcal{L}2\)-normalized \(u\) and \(v\) (i.e., cosine similarity), \(N_{b}\) is the sample size of a minibatch, and \(\tau\) is the temperature parameter to help the model learn from hard negatives. Furthermore, evaluating the similarity between raw and augmented samples makes the representation closer to the original data distribution, thereby minimizing the DAB of extracted contextual features. This similarity is optimized by \(L_{\text{CC}}^{\text{t}}\) and \(L_{\text{CC}}^{\text{t}}\) as follows:

\[L_{\text{CC}}^{\text{s}}=-\sum_{i=1}^{N_{b}}log\frac{exp(\text{sim}((p_{i}^{ \text{s}},p_{i}^{\text{u}})/\tau)}{\sum_{k\
eq i}exp(\text{sim}((p_{i}^{\text {t}},p_{k}^{\text{u}})/\tau)} \tag{4}\]

\[L_{\text{CC}}^{\text{t}}=-\sum_{i=1}^{N_{b}}log\frac{exp(\text{sim}((p_{i}^{ \text{t}},p_{i}^{\text{u}})/\tau)}{\sum_{k\
eq i}exp(\text{sim}((p_{i}^{\text {t}},p_{k}^{\text{u}})/\tau)} \tag{5}\]

For Equations (4) and (5), \(\text{sim}(u,v)=u^{\text{T}}v\) denotes the dot product (i.e., dot similarity). The DABMinLoss is the combination of the \(L_{TC}\) and \(L_{CC}\) as follows:

\[\mathcal{L}=\lambda_{1}\cdot L_{\text{TC}}^{\text{s}}+\lambda_{2}\cdot L_{ \text{TC}}^{\text{t}}+\lambda_{3}\cdot L_{\text{CC}}^{\text{st}}+\lambda_{4} \cdot(L_{\text{CC}}^{\text{t}}+L_{\text{CC}}^{\text{s}}) \tag{6}\]

where \(\lambda_{1}\), \(\lambda_{2}\), \(\lambda_{3}\), and \(\lambda_{4}\) are fixed scalar hyper-parameters denoting the relative weight of each loss. DABMinLoss minimizes the DAB of extracted temporal and contextual features. Therefore, the learned representation has lower DAB, which can achieve better performance in the downstream task. ## 3 Results

### Comparison with Baseline Approaches

The performances of DABaCLT are compared with the baseline approaches: (1) Supervised: supervised training of both encoder and classifier models; (2) SimCLR [13]; (3) TS-TCC [21]; and (4) TS2 Vec [16]. The publicly available or re-implemented codes were used for the baseline models. Brief descriptions of the models are as follows:

simCLR learns representations by maximizing the agreement between different augmented views of the same data example through contrastive loss in latent space. Two different data augmentation operators are sampled from the same augmentation family. TS-TCC encourages the consistency of different data augmentations to learn transformation-invariant representations. It learns robust representations from time series data through a difficult cross-view prediction task.