SlowGuess/NeurIPS_2023_OCR huggingface dataset:
From these tables, we can see that our proposed method significantly outperforms DACL, which suggests creating a positive sample by mixing fixed hidden representations in an intermediate layer [22], by a large margin (up to  $20.8\%$  with a  $10.1\%$  on average in activity recognition). This suggests that when the representations are not yet linearly separable at the beginning of the contrastive training process, the interpolated representations using mixup may be dissimilar to the actual interpolated samples and may not capture their underlying features. One interesting result from our experiments is that IDAA [53] exhibits comparable performance to our method in some datasets, and even slightly outperforms our approach in the HHAR dataset for activity recognition. Despite using distinct methods to generate positive instances, i.e., adversarial and mixup, our approach and IDAA algorithm
Table 2: Performance comparison of ours with prior works in Heart Rate Prediction datasets
Method	IEEE SPC12	IEEE SPC 22	DaLia
MAE↓	RMSE↓	MAE↓	RMSE↓	MAE↓	RMSE↓
Supervised
DCL	22.02	28.44	28.10	32.45	6.58	11.30
CNN Ensemble* [39]	3.89	-	8.74	-	8.58	-
Self-Supervised
Traditional Augs.	20.67 ± 1.13	26.35 ± 0.98	16.84 ± 1.10	22.23 ± 0.72	12.01 ± 0.65	21.09 ± 0.86
NNCLR [49]	20.28 ± 2.21	28.23 ± 1.63	23.49 ± 1.54	28.75 ± 3.66	11.56 ± 0.63	19.95 ± 0.89
InfoMin [48]	36.84 ± 5.11	29.78 ± 7.31	31.58 ± 4.72	29.72 ± 4.83	45.89 ± 8.71	50.77 ± 9.72
IDAA [53]	19.02 ± 0.96	27.42 ± 1.11	15.37 ± 1.21	22.41 ± 1.42	11.12 ± 0.64	20.45 ± 0.69
PosET [50]	25.60 ± 1.93	33.80 ± 2.71	23.42 ± 1.50	31.51 ± 3.71	35.99 ± 3.95	39.92 ± 3.12
STAug [52]	27.44 ± 1.93	35.63 ± 3.10	19.86 ± 2.11	30.70 ± 3.54	18.70 ± 4.06	30.81 ± 3.61
Aug. Bank [21]	27.31 ± 2.17	37.93 ± 2.96	27.84 ± 2.03	36.41 ± 3.98	35.87 ± 4.18	40.61 ± 3.74
GenRep [51]	21.02 ± 1.41	28.42 ± 1.65	15.67 ± 1.23	22.33 ± 1.43	25.41 ± 1.62	36.83 ± 1.87
DACL [22]	21.85 ± 1.63	28.17 ± 1.75	14.67 ± 1.10	20.06 ± 1.21	18.44 ± 1.32	25.61 ± 1.45
Ours	16.26 ± 0.72	22.48 ± 0.95	12.25 ± 0.47	18.20 ± 0.61	10.57 ± 0.55	20.37 ± 0.73
* The entire dataset, excluding the test, is utilized with labels, while in DCL, the labeled data size matches that of the CL
share similarities in approaches for positive instance generation in CL setup. The IDAA algorithm aims to create hard positive samples that lie near class boundaries without changing the identity of the sample, while our method interpolates two samples to produce a positive instance that is similar to the original sample while adding noise to the phase and amplitude in the direction of a randomly chosen sample. In other words, both approaches try to keep the sample identity intact by taking special precautions while generating new positive instances, which may explain their similar performance in our experiments.
In contrast, approaches that do not prioritize preserving sample identity while generating samples or hidden representations often demonstrate suboptimal performance on average while exhibiting increased variability across tasks.
Examples of such methods include PosET [50], which generates hard positive samples to improve contrastive learning by extrapolating features, STAug [52], which uses empirical mode decomposition with linear mixup technique together, and InfoMin [48], which tries to minimize mutual information between two instances in an adversarial manner. The performance comparison of prior mixup techniques and our proposed one is shown in Figure 2. On average, our proposed method outperforms all other mixup techniques while reducing the variance across tasks. What is interesting about this figure is that while the linear [31] and amplitude mixup [45] reach our method in some datasets for activity recognition, the performance of the linear mixup decreases heavily for the other two tasks whereas the amplitude mixup gives reasonable per
formance. This empirical outcome supports our initial theorem about the destructive effect of mixup, which suggests linear mixup or other derivatives can discard the whole task-specific information in the generated positive sample for quasi-periodic signals even though the mixing coefficient is sampled from a distribution such that the generated samples are much closer to the anchor.
Table 3: Performance comparison between ours and prior work in CVD.
Method	CPSC 2018	Chapman
AUC↑	AUC↑
Supervised
CNN [57]	—	95.80
Casual CNN [58]	—	97.70
Self-Supervised
Traditional Augs.	67.86 ± 3.41	74.69 ± 2.04
NNCLR [49]	70.06 ± 2.05	77.19 ± 2.41
InfoMin [48]	64.48 ± 6.15	56.34 ± 9.12
IDAA [53]	80.90 ± 0.73	93.63 ± 0.91
PosET [50]	72.58 ± 2.12	78.27 ± 2.34
STAug [52]	74.15 ± 1.15	93.88 ± 0.87
Aug. Bank [21]	81.78 ± 1.24	94.75 ± 0.90
GenRep [51]	52.49 ± 3.43	86.72 ± 1.13
DACL [22]	82.38 ± 0.84	92.28 ± 0.97
Ours	85.30 ± 0.45	95.90 ± 0.82
Here, we present a comprehensive examination of our proposed method and the effect of its components on the performance. Mainly, we investigate the effect of the proposed mixup by applying the instance selection algorithm to the linear mixup (w/o Prop. Mixup). Then, we perform our proposed mixup with the constant  $\lambda_{A}$  and  $\lambda_{P}$  coefficients without investigating latent space distances between pairs (w/o Aug. Degree). Tables 4, 5 and 6 summarize the results. The second row in the tables shows the performance when the proposed mixup method is not applied while choosing mixup coefficients according to the distances in the latent space for the linear mixup. The last row illustrates
Figure 2: The comparison of mixup methods where the error bars represent the deviation across random seeds (explicit numbers are given in Appendix E). a) shows the performance in activity recognition, b) is for heart rate prediction, and finally c) shows the CVD classification. For the last two tasks, we excluded Geomix as its performance is extremely poor and distorts the y-axis scale.
the performance change resulting from randomly sampling mixup coefficients without considering any relationship between the selected pair while applying tailored mixup for phase and magnitude.
Table 4: Ablation on proposed mixup with coefficient selection in Activity Recognition datasets
Method	UCIHAR	HHAR	USC
ACC↑	MF1↑	ACC↑	MF1↑	ACC↑	MF1↑
Ours	91.60 ± 0.65	90.46 ± 0.53	88.05 ± 1.05	87.95 ± 1.10	60.13 ± 0.75	59.13 ± 0.69
w/o Prop. Mixup	83.09 (-8.51)	81.65 (-8.81)	85.89 (-2.16)	86.01 (-1.94)	45.10 (-15.03)	43.64 (-15.49)
w/o Aug. Degree	80.86 (-10.74)	80.18 (-10.26)	87.53 (-0.95)	87.75 (-0.20)	57.00 (-3.13)	54.75 (-4.38)
The results obtained from the ablation study support the previous claims and outcomes. For example, when the linear mixup is applied instead of the proposed mixup technique for heart rate prediction (Table 5, w/o Prop. Mixup), the performance decrease is significant compared to the case when coefficients are sampled without considering the distance in the latent space (Table 5, w/o Aug. Degree). This observation indicates that as the periodicity in data increases, linear mixup can lead to significant destructive interferences, whereas our method effectively prevents such issues.
Table 5: Ablation on proposed mixup with coefficient selection in Heart Rate Prediction datasets.
Method	IEEE SPC12	IEEE SPC 22	DaLia
MAE↓	RMSE↓	MAE↓	RMSE↓	MAE↓	RMSE↓
Ours	16.26 ± 0.72	22.48 ± 0.95	12.25 ± 0.47	18.20 ± 0.61	10.57 ± 0.55	20.37 ± 0.73
w/o Prop. Mixup	20.45 (+4.19)	28.51 (+6.03)	15.29 (+3.04)	24.08 (+5.88)	24.11 (+13.54)	35.45 (+15.18)
w/o Aug. Degree	19.30 (+3.04)	24.84 (+2.36)	16.01 (+3.76)	21.21 (+3.19)	11.10 (+0.53)	20.13 (-0.24)
While our mixup technique consistently enhances performance across datasets, we observe a decline when the mixing coefficients are sampled based on the distance in the latent space for two datasets. Also, the performance increase gained by sampling coefficients based on distance is relatively low compared to the proposed mixup. Several factors can explain this observation. First, the VAE might not be
Table 6: Ablation on proposed mixup with coefficient selection in CVD.
Method	CPSC 2018	Chapman
AUC↑	AUC↑
Ours	85.30 ± 0.45	95.90 ± 0.82
w/o Prop. Mixup	81.20 (-4.10)	86.30 (-9.60)
w/o Aug. Degree	80.67 (-4.63)	95.98 (+0.08)
well trained due to the limited size of data in each class, i.e., the assumption in Proposition 3.2 does not hold. This can lead to inconsistencies in the semantic similarity of the latent space such that two close samples in the latent space might have different labels. Second, if the number of classes increases for a downstream task, the probability of sampling intra-class samples in a batch will decrease, leading to a lack of performance improvement. Therefore, in future investigations, it might be beneficial to use a different distance metric for quasi-periodic time-series data such that it can scale with the number of classes while considering the lack of big datasets.
More ablation studies about the sensitivity of mixing coefficients and performance in different self-supervised learning frameworks, like BYOL [59] can be found in Appendix E.1 and E.2. And, investigations regarding whether we still need known data augmentations are given in Appendix E.3. Examples that visually demonstrate the negative effects of linear mixup and our proposed mixup
technique to prevent this problem can be found in Appendix F. Comparative results regarding the performance of the tailored mixup in the supervised learning paradigm are given in Appendix G.
The goal of contrastive learning is to contrast positive with negative pairs [60]. In other words, the embedding space is governed by two forces, the attraction of positive pairs and the repellence of negatives, actualized through the contrastive loss [61]. Since label information is unavailable during the training, positive pairs are generated using augmentation techniques on a single sample, while negative pairs are randomly sampled from the entire dataset. Therefore, the choice or generation of positive and negative samples plays a pivotal role in the success of contrastive learning [62-65] and both approaches, generation/selection of positive/negative pairs, have been investigated thoroughly in the literature [66-71], we limit our discussion about prior works related to data augmentation techniques that create optimal or hard samples without labels.
Adversarial based approaches A growing body of literature has investigated generating samples by using adversarial training for both positives and negatives [48, 72, 73]. A seminal work about the importance of augmentations in CL, InfoMin, presented an adversarial training strategy where players try to minimize and maximize the mutual information using the NCE loss [48]. CLAE, one of the first works that leveraged the adversarial approach, shows that adversarial training generates challenging positive and hard negative pairs [72]. Another recent study proposed an adversarial approach that generates hard samples while retaining the original sample identity by leveraging the identity-disentangled feature of VAEs [53]. However, adversarial augmentations may change the original sample identity due to excessive perturbations and it is infeasible to tune the attack strength for every sample to preserve the identity. In other words, these approaches do not consider the sample-specific features and use a constant perturbation coefficient for all samples whereas our proposed method considers the similarity between pairs and tunes the mixing coefficients accordingly.
Mixup based approaches Mixup-based methods have been recently explored in contrastive learning [22, 71, 47, 74, 75]. According to a recent theoretical work [22], mixup has implicit data-adaptive regularization effects that promote generalization better than adding Gaussian noise, which is a commonly used augmentation strategy in both time-series and vision data [76-78]. Although, mixup-based approaches have shown success in different problems [79, 80], such as domain adaptation, creating samples using mixup in the input space is infeasible in domains where data has a non-fixed topology, such as sequences, trees, and graphs [22]. Therefore, recent works suggest mixing hidden representations of samples, similar to Manifold Mixup [81]. However, this method claims that mixing fixed-length hidden representation via an intermediate layer "z = αz + (1 - α)tilde{z}" can be interpreted as adding noise to a given sample in the direction of another. However, it is an overly optimistic claim because early during training, where in most cases there is usually no linear separability among the representations, this synthesis may result in hidden representations that are completely different and far away from the samples [71, 82]. Therefore, in this work, we take a different approach and modify the mixup method considering its limitations for quasi-periodic non-stationary time-series data. Also, unlike most existing methods that aim to generate hard samples—samples that are close to class boundaries—using adversarial approaches [53, 48, 72] or feature extrapolation [50, 71], our method seeks to connect semantically closer samples together using interpolation in a tailored way.
In this paper, we first demonstrate the destructive effect of linear mixup for quasi-periodic time-series data, then introduce a novel tailored mixup method to generate positive samples for the contrastive learning formulation while preventing this destructive effect and interpolating the samples appropriately. Theoretically, we show that our proposed method guarantees the interpolation of pairs without causing any loss of information while generating a diverse set of samples. Empirically, our method outperforms the prior approaches in three real-world tasks. By conducting experiments on contrastive and supervised learning settings, we show that our approach is agnostic to the choice of learning paradigm. Thus, it holds the potential for utilization in generating augmented data for different learning paradigms as well. We believe that the method proposed in this paper has the potential to significantly improve learning solutions for a diverse range of time series tasks.
In this section, we present complete proofs of our theoretical study, starting with notations.
Fourier transform of a real-valued sample with a finite duration is obtained as in Equation 7.
$$
\mathrm {X} _ {k} = \mathcal {F} (\mathbf {x}) = \sum_ {n = - \infty} ^ {\infty} \mathbf {x} _ {n} e ^ {- j 2 \pi k n} \tag {7}
$$
The amplitude and phase for each frequency are calculated from the Fourier transform as follows.
$$
A (\mathbf {x}) = \sqrt {\operatorname {R e} \left(\mathrm {X} _ {k}\right) ^ {2} + \operatorname {I m} \left(\mathrm {X} _ {k}\right) ^ {2}} \tag {8}
$$
$$
P (\mathbf {x}) = \arctan 2 \left(\operatorname {I m} \left(\mathrm {X} _ {k}\right), \operatorname {R e} \left(\mathrm {X} _ {k}\right)\right),
$$
where  $\arctan$  is a 2-argument arctangent which is the angle measure in radians. The phasor, as in Figure 1, of a sample is represented as in Equation 9.
$$
\mathrm {X} _ {k} = \mathcal {F} (\mathbf {x}) = A (\mathbf {x}) e ^ {j P (\mathbf {x})} \tag {9}
$$
A.2 Proof for Proposition 2.3
Proposition A.1 (Destructive Mixup). If Assumptions 2.1 and 2.2 hold, there exist  $\lambda \sim \text{Beta}(\alpha, \alpha)$  or  $\lambda \sim U(\beta, 1.0)$  with high values of  $\beta$  such that when linear mixup techniques are utilized, the lower bound of the mutual information for the augmented sample distribution decreases to zero.
$$
0 \leq \mathcal {I} (\mathbf {y}; \mathbf {x} ^ {+}) <   \mathcal {I} (\mathbf {y}; \mathbf {x} ^ {*}) \quad \text {w h e r e}
$$
$$
\mathbf {x} ^ {+} = \lambda \mathbf {x} + (1 - \lambda) \tilde {\mathbf {x}} \text {a n d} \int_ {f ^ {*}} S _ {x ^ {*}} (f) = \int_ {- \infty} ^ {\infty} S _ {x ^ {*}} (f) \tag {10}
$$
$$
\mathbf {x} ^ {+} = \lambda \mathbf {x} + (1 - \lambda) \tilde {\mathbf {x}} \tag {11}
$$
From the linearity of Fourier transformation and ignoring  $k$  in  $X_{k}$  for the sake of easiness.
$$
\mathrm {X} ^ {+} = \lambda \mathbf {X} + (1 - \lambda) \tilde {\mathbf {X}} \tag {12}
$$
$$
\mathrm {X} ^ {+} = \tilde {\mathbf {X}} + \lambda (\mathbf {X} - \tilde {\mathbf {X}}) \tag {13}
$$
Let  $\tilde{\mathbf{X}} = e^{-j\omega \phi_k}\mathbf{X}\omega_k$ , where  $\phi_{k}$  and  $\omega_{k}$  are random phase and frequency modulators for each frequency, sampled from distributions  $\phi_k\sim \Phi ,\omega_k\sim \Omega$
$$
\mathrm {X} ^ {+} = e ^ {- j \omega \phi_ {k}} \mathbf {X} \boldsymbol {\omega} _ {k} + \lambda (\mathbf {X} - e ^ {- j \omega \phi_ {k}} \mathbf {X} \boldsymbol {\omega} _ {k}) \tag {14}
$$
$$
\mathrm {X} ^ {+} = \mathbf {X} \left[ \lambda + e ^ {- j \omega \phi_ {k}} \boldsymbol {\omega} _ {k} - \lambda e ^ {- j \omega \phi_ {k}} \boldsymbol {\omega} _ {k} \right] \tag {15}
$$
$$
\mathbf {X} ^ {+} = \mathbf {X} [ \lambda + (1 - \lambda) e ^ {- j \omega \phi_ {k}} \omega_ {k} ] \tag {16}
$$
$$
\mathrm {X} ^ {+} = \mathbf {X} [ \lambda + (1 - \lambda) \omega_ {k} (\cos (\omega \phi_ {k}) - j \sin (\omega \phi_ {k})) ] \tag {17}
$$
From the quasi-periodicity, assume that the frequency ranges of interest  $(f^{*}$ , i.e.,  $k^{*}$ ) are overlapped for both samples while the sampled random modulators have the following relationship.
$$
\omega_ {k ^ {*}} \approx \frac {\lambda}{1 - \lambda} \text {a n d} \theta \equiv \left[ \omega \phi_ {k ^ {*}} \right] (\mathrm {m o d} 2 \pi), \tag {18}
$$
where  $\theta$  is an odd multiple of  $\pi$ . Equation 17 can be simplified as follows.
$$
\mathbf {X} _ {k ^ {*}} ^ {+} = \mathbf {X} _ {k ^ {*}} \left[ \lambda + \lambda \cos \left(\omega \phi_ {k ^ {*}}\right) \right] \tag {19}
$$
$$
\mathrm {X} _ {k ^ {*}} ^ {+} \approx 0 \tag {20}
$$
$$
\mathrm {X} _ {k ^ {*}} ^ {+} = \sum_ {n = - \infty} ^ {\infty} \mathbf {x} _ {n} e ^ {- j 2 \pi k ^ {*} n} \longrightarrow \sum_ {n = - \infty} ^ {\infty} \mathbf {x} _ {n} e ^ {- j 2 \pi k ^ {*} n} \approx 0 \tag {21}
$$
$$
S _ {x ^ {+}} \left(f ^ {*}\right) = \lim  _ {N \rightarrow \infty} \frac {1}{2 N} \left| \sum_ {n = - N} ^ {N} x _ {n} e ^ {- j 2 \pi f ^ {*} n} \right| ^ {2} \tag {22}
$$
From Assumption 2.1,
$$
\mathcal {I} (\mathbf {y}; \mathbf {x} ^ {+}) \propto \int_ {f ^ {*}} S _ {x ^ {+}} (f) / \int_ {- \infty} ^ {\infty} S _ {x ^ {+}} (f) \tag {23}
$$
$$
0 \leq \mathcal {I} (\mathbf {y}; \mathbf {x} ^ {+}) <   \mathcal {I} (\mathbf {y}; \mathbf {x} ^ {*}) \tag {24}
$$
We use Euler's formula to expand Equation 16 to 17. While we use the frequency bins  $(k)$  and frequency values in  $\mathrm{Hz}(f)$  interchangeably for Equations 21 and 22.
Although the above proof is to show the resulting instances may not contain any task-relevant information, it can also be demonstrated that the augmentation process can potentially discard the partial task-specific information (not whole) if  $\phi_{k}$  and  $\omega_{k}$  are close to indicated relationships.
A.3 Proof for Theorem 3.1
Theorem A.2 (Guarantees for Mixing). Under assumptions 2.1 and 2.2, given any  $\lambda \in (0,1]$ , the mutual information for the augmented instance lower bounded by the sampled  $\lambda$  and anchor  $\mathbf{x}$
$$
\lambda \mathcal {I} (\mathbf {y}; \mathbf {x}) \leq \mathcal {I} (\mathbf {y}; \mathbf {x} ^ {+}) <   \mathcal {I} (\mathbf {y}; \mathbf {x} ^ {*}) \text {w h e r e} \mathbf {x} ^ {+} = \mathcal {F} ^ {- 1} (A (\mathbf {x} ^ {+}) \angle P (\mathbf {x} ^ {+})) \tag {25}
$$
$$
\mathbf {x} ^ {+} = \mathcal {F} ^ {- 1} (A (\mathbf {x} ^ {+}) \angle P (\mathbf {x} ^ {+})) \quad \text {w h e r e}
$$
$$
A \left(\mathbf {x} ^ {+}\right) = \lambda_ {A} A (\mathbf {x}) + \left(1 - \lambda_ {A}\right) A (\tilde {\mathbf {x}}) \text {a n d} \tag {26}
$$
$$
P (\mathbf {x} ^ {+}) = \left\{ \begin{array}{l l} P (\mathbf {x}) - | \Delta \Theta | * (1 - \lambda_ {P}), & \text {i f} \Delta \Theta > 0 \\ P (\mathbf {x}) + | \Delta \Theta | * (1 - \lambda_ {P}), & \text {o t h e r w i s e} \end{array} \right.
$$
$$
\mathrm {X} ^ {+} = A \left(\mathbf {x} ^ {+}\right) e ^ {j P \left(\mathbf {x} ^ {+}\right)} \tag {27}
$$
$$
\left| \mathrm {X} ^ {+} \right| = \left| A \left(\mathbf {x} ^ {+}\right) e ^ {j P \left(\mathbf {x} ^ {+}\right)} \right| \tag {28}
$$
$$
\left| \mathrm {X} ^ {+} \right| = A \left(\mathbf {x} ^ {+}\right) \quad \text {w h e r e} \quad \left| \mathrm {X} _ {k} ^ {+} \right| = \left| \sum_ {n = - \infty} ^ {\infty} \mathbf {x} _ {n} ^ {+} e ^ {- j 2 \pi k n} \right| \tag {29}
$$
$$
\left| \mathrm {X} ^ {+} \right| = \lambda A (\mathbf {x}) + (1 - \lambda) A (\tilde {\mathbf {x}}) \tag {30}
$$
$$
\left| \mathrm {X} ^ {+} \right| = \lambda \left| \sum_ {n = - \infty} ^ {\infty} \mathbf {x} _ {n} e ^ {- j 2 \pi k n} \right| + (1 - \lambda) \left| \sum_ {n = - \infty} ^ {\infty} \tilde {\mathbf {x}} _ {n} e ^ {- j 2 \pi k n} \right| \tag {31}
$$
$$
\lambda \left| \sum_ {n = - \infty} ^ {\infty} \mathbf {x} _ {n} e ^ {- j 2 \pi k n} \right| + (1 - \lambda) \left| \sum_ {n = - \infty} ^ {\infty} \tilde {\mathbf {x}} _ {n} e ^ {- j 2 \pi k n} \right| \geq \lambda \left| \sum_ {n = - \infty} ^ {\infty} \mathbf {x} _ {n} e ^ {- j 2 \pi k n} \right| \tag {32}
$$
$$
\int_ {f ^ {*}} S _ {x ^ {+}} (f) \geq \lambda \int_ {f ^ {*}} S _ {x} (f) \tag {33}
$$
Using the  $\int_{-\infty}^{\infty}S_{x^{+}}(f) = \int_{\infty}^{\infty}S_{\bar{x}}(f)$  (i.e., both samples are normalized to have the same power) and Assumption 2.1,
$$
\mathcal {I} \left(\mathbf {y}; \mathbf {x} ^ {+}\right) \propto \int_ {f ^ {*}} S _ {x ^ {+}} (f) / \int_ {- \infty} ^ {\infty} S _ {x ^ {+}} (f) \tag {34}
$$
$$
\lambda \mathcal {I} (\mathbf {y}; \mathbf {x}) \leq \mathcal {I} (\mathbf {y}; \mathbf {x} ^ {+}) <   \mathcal {I} (\mathbf {y}; \mathbf {x} ^ {*}) \tag {35}
$$
Proof is completed with Equation 35 by combining equations 33 and 34.
Although this proof ignores the effect of phase mixing on the mutual information with the assumption 2.1, it is known that phase components carry semantically important features [45]. Therefore, it is necessary to note that the objective of this proof is to demonstrate that by applying mixup separately to the phase and amplitude components, we can avoid destructive interference.
In this section, we give details about the datasets that are used during our experiments.
B.1 Human Activity Recognition
UCIHAR Human activity recognition using smartphones dataset (UCIHAR) [34] is collected by 30 subjects within an age range of 16 to 48 performing six daily living activities with a waist-mounted smartphone. Six activities include walking, sitting, lying, standing, walking upstairs, and walking downstairs. Data is captured by 3-axial linear acceleration and 3-axial angular velocity at a constant rate of  $50\mathrm{Hz}$ . We used the pre-processing technique the same as in [37, 19] such that the input contains nine channels with 128 features (it is sampled in sliding window of 2.56 seconds and  $50\%$  overlap, resulting in 128 features for each window). Windows are normalized to zero mean and unit standard deviation before feeding to models. Also, we follow the same experimental setup with prior works as follows. The experiments are conducted with a leave-one-domain-out strategy, where one of the domains is chosen to be the unseen target [19]. The contrastive pre-training is conducted with all subjects without any label information except the target one. Training of the linear layer, which is added to the frozen trained encoder, is only performed with the first five subjects of UCIHAR after excluding the target subject. In other words, if the target subject is 0, the subjects from 1 to 29 are used to train the encoder without any label information. Then, subjects from 1 to 4 are used to train the linear layer. And, evaluation is performed for subject 0. This is performed for the first five subjects with three random seeds and the mean value is reported.