SlowGuess/NeurIPS_2023_OCR huggingface dataset:
$$
\bar {\mathbf {p}} ^ {\odot \frac {1}{2}} = \frac {1}{K} \sum_ {k = 1} ^ {K} \mathbf {p} _ {k} ^ {\odot \frac {1}{2}}
$$
$$
\bar {\mathbf {p}} = \left(\frac {1}{K} \sum_ {k = 1} ^ {K} \mathbf {p} _ {k} ^ {\odot \frac {1}{2}}\right) ^ {\odot 2}
$$
PROOF. A second possible proof is considering the optimization problem w.r.t  $\pmb{\Sigma}$ :
$$
\bar {\boldsymbol {\Sigma}} = \arg \min  _ {\boldsymbol {\Sigma}} \sum_ {k = 1} ^ {K} \operatorname {T r} \left(\boldsymbol {\Sigma} + \boldsymbol {\Sigma} _ {k} - 2 \left(\boldsymbol {\Sigma} ^ {\frac {1}{2}} \boldsymbol {\Sigma} _ {k} \boldsymbol {\Sigma} ^ {\frac {1}{2}}\right) ^ {\frac {1}{2}}\right). \tag {10}
$$
As mentioned above, it is possible to use the PSD  $\mathbf{p}$  to transform the equation into an element-wise problem as before:
$$
\bar {\mathbf {p}} = \arg \min  _ {\mathbf {p}} \sum_ {k = 1} ^ {K} \| \mathbf {p} + \mathbf {p} _ {k} - 2 \left(\mathbf {p} ^ {\frac {1}{2}} \odot \mathbf {p} _ {k} \odot \mathbf {p} ^ {\odot \frac {1}{2}}\right) ^ {\odot \frac {1}{2}} \| _ {1}
$$
$$
\bar {\mathbf {p}} = \underset {\mathbf {p}} {\arg \min } \sum_ {k = 1} ^ {K} \| \mathbf {p} + \mathbf {p} _ {k} - 2 \mathbf {p} ^ {\odot \frac {1}{2}} \odot \mathbf {p} _ {k} ^ {\odot \frac {1}{2}} \| _ {1} \tag {11}
$$
After derivation, the  $\bar{\mathbf{p}}$  minimizing the optimization problem is given by:
$$
\bar {\mathbf {p}} = \left(\frac {1}{K} \sum_ {k = 1} ^ {K} \mathbf {p} _ {k} ^ {\odot \frac {1}{2}}\right) ^ {\odot 2} \tag {12}
$$
A.2 Computation
The training is done on Tesla V100-DGXS-32GB with Pytorch. We are considering the following train settings: Chambon architecture with a learning rate of  $1e^{-3}$  for Adam optimizer and a patience of 10 for the early stopping. The training for one dataset pair with ten different splits and seeds lasts approximately 1 hour. The data processing time with the CMMN is insignificant compared to the network's computation time (a few minutes).
A.3 Dataset descriptions
SHHS The Sleep Heart Health Study is a multi-center cohort study proposed by the National Heart Lung & Blood Institute [4, 37] to help detect cardiovascular disease and sleep disorders. This large dataset comprises 6441 subjects (age  $63.1 \pm 11.2$ ) from 1995 to 1998. Five sensors are available for each subject: 2 EEGs from C3-A2 and C4-A1 channels, left and right EOGs, and one EMG. The EEGs have a sampling rate of  $125\mathrm{Hz}$ . The hypnograms were scored according to the Rechtschaffen and Kales criteria [51].
MASS The Montreal Archive of Sleep Studies comprised five different subsets of recordings. This paper focuses on the SS3 with recordings from 62 healthy subjects (age  $42.5 \pm 18.9$ ). For each subject, 20 EEGs, left and right EOGs, and 3 EMGs are available. We reduced the number of EEG channels to 2 bipolar channels, Fpz-Cz and Pz-Cz, obtained by montage reformating. The EEGs have a sampling rate of  $256\mathrm{Hz}$ . The MASS hypnograms were scored according to the AASM criteria [52].
Physionet SleepEDF This dataset comprises two subsets, one for the age effect in healthy subjects (SC) and one for the Temazepam effect on sleep (ST). We focused on the SC subset where 78 subjects are available (age  $28.7 \pm 2.9$ ). Each recording comprises 2 EEGs from Fpz-Cz and Pz-Cz channels, 1 EOG, and 1 EMG. The EEGs have a sampling rate of  $100\mathrm{Hz}$ . Some of the subjects have two sessions of PSGs available. The hypnograms were scored according to the Rechtschaffen and Kales criteria [51]. The stages N3 and N4 have been merged for the following.
Ethical consideration All datasets used in our experiments are anonymized and public datasets that have already passed an ethics committee before recording.
A.4 Sensitivity analysis to the filter size
Several adaptations across different dataset pairs are done to compare the effect of the filter size. The smallest filter size means no transformation, and the largest size corresponds to a perfect transformation between the two signals. For each parameter, ten training are done over data from the source dataset and then tested over data from the target dataset.
To evaluate the benefit of the method, we measure the  $\Delta$ BACC corresponding to the difference between the balanced accuracy score with monge mapping and the balanced accuracy score without monge mapping (i.e., using Sample normalization). The Figure 2 shows the evaluation of  $\Delta$ BACC with filter size for different dataset pairs. The slightest improvement is for adaptation between the same dataset, which is logical because there is less difference to compensate between the subjects. And the best improvement is for the most challenging task, adaptation between datasets with different sensors (MASS/Physionet  $\rightarrow$  SHHS). The mapping did not capture enough information for the smallest filter size to reduce the difference between distributions. On the other hand, the bigger the distribution gap between datasets, the bigger the filter size helps to adapt. Indeed, for an adaptation between the same dataset, having a filter size close to the sample size decreases the performance (see MASS  $\rightarrow$  MASS, Physionet  $\rightarrow$  Physionet), while for an adaptation between two different or very different datasets, increasing the filter size causes the performance to remain the same (MASS  $\leftrightarrow$  Physionet) or even increases the scores considerably (MASS/Physionet  $\rightarrow$  SHHS).
A.5 Boxplot of BACC for different data normalizations, different architectures, and different dataset pairs
As shown in the experimental section of the paper, CMMN outperforms standard normalization (Session or Sample) for different architectures. Here we provide more boxplots for other dataset
Figure 2: Evolution of the  $\Delta$ BACC (BACC - BACC without mapping) for different filter sizes for different adaptation problems
pairs than in the main article. For Chambon, the figure 3f shows again that CMMN outperforms other normalizations except with dataset SHHS in target. Indeed, if CMMN is still better than Sample and Session, using no normalization is better for this experimental setting. SHHS is the most different dataset since the sensors used differ from Physionet and MASS, which can explain this difference. Even when SHHS is in train, CMMN is better than None.
The results for DeepSleepNet in figure 4f are slightly different. If CMMN is still the better performer overall, the best standard normalization is None. Using no normalization is better in 5/6 dataset pairs over Sample and Session. These results were expected since no normalization was used in the paper proposing DeepSleepNet [7].
For the sake of simplicity, we used Sample normalization before CMMN and also for the baseline No Adapt. even for DeepSleepNet.
A.6 Scatterplot for different architectures and different dataset pairs
One significant benefit of CMMN is to have a massive impact on low-performing subjects. The scatter plots of balanced accuracy (BACC) with No Adapt as a function of BACC with CMMN emphasize this effect. In this section, the plots in figure 5f and figure 6f show the increase in all subjects. For both architectures, the axis of the linear regression is always above the axis  $x = y$ . The differences between the two axes are generally higher for lower performances, which means that the worst the performance is, the higher the increase is. For the eccentric dots on the left (i.e., low-performing subjects), the increase is generally around  $8\%$  (see Table 4). When SHHS is the training set, low-performing subjects get a considerable boost. On the other hand, for Physionet  $\leftrightarrow$  MASS with Chambon, some subjects lose accuracy, but it remains rare compared to the average gain on all subjects.
(f)
Figure 3: Boxplot of balanced accuracy (BACC) for different normalizations and different train/test dataset pairs with Chambon.
(d)
(f)
Figure 4: Boxplot of balanced accuracy (BACC) for different normalizations and different train/test dataset pairs with DeepSleepNet.
(f)
Figure 5: Scatter plot of balanced accuracy (BACC) with No Adapt as a function of BACC with CMMN for different dataset pairs with Chambon.
(f)
Figure 6: Scatter plot of balanced accuracy (BACC) with No Adapt as a function of BACC with CMMN for different dataset pairs with DeepSleepNet