dataesr/scientific-paragraphs-categorization huggingface dataset:
Methods To describe dataset shifts that can occur with M/EEG signals, we extend the generative model of M/EEG regression tasks from  (Sabbagh et al. , 2020)  where the prediction outcome is continuous. A canonical example that we will use in this work is brain age prediction  (Engemann et al. , 2022; Xifra-Porxas et al. , 2021). This model has also been applied to event-level regression of muscular activity with electromyogram and MEG recordings  (Sabbagh et al. , 2020). We describe and discuss the parameters of the generative model to understand which mechanisms can explain dataset shifts. Finally, we present various alignment strategies aiming to draw a geometrical analysis of the possible shifts and compensate for them. x i (t) ∈ R P is written as: x i (t) = A ′ s i (t) + A ′′ n i (t) , (1) where s i (t) ∈ R Q is the underlying signal generating this observation with Q ≤ P , and n i (t) ∈ R (P -Q) ∼ N (0, σ 2 n I P -Q ) causes a contamination due to noise.
Possible data shifts Each parameter of the model described in equations (  2 ) and (  6 ) can vary for different reasons. We are interested in fitting a regression algorithm to a source dataset X (S) = x (S) i , i = 1,. , N (S) to later predict outcomes on a distinct target dataset X (T ) = x (T ) i , i = 1,. , N (T ) both recorded with the same P sensors. The datasets are not necessarily composed of the same number of subjects. Applying our previous notations, we can describe the source dataset as follows:          x (S) i (t) = A ′ (S) i s (S) i (t) + A ′′ (S) i n (S) i (t) = A (S) i η (S) i (t) y (S) i = β 0 + Q j=1 β j log 1 T T t=1 (s (S) i,j (t)) 2 + ϵ (S) i ( 12 ) where A (S) i = A (S) +E (S) i with E (S) i ∼ N 0, σ (S) A 2 I P , n (S) i ∼ N 0, σ (S) n 2 I P -Q and ϵ i ∼ N 0, σ (S) ϵ 2.
We remind that the statistical generator powers are defined as diag(p (S) i ) = E t s (S) i (t)s (S)⊤ i (t). The same equations can be written for the target dataset by replacing the exponent (s) by (t). We now list physical reasons that could induce differences between source and target datasets and link them to parameter changes of the corresponding generative models (12). 1. If we consider two different populations, the head morphology may vary, and the subject-averaged mixing matrices A (S) and A (T ) would differ. 2. Having different populations in both datasets would also imply that they will not have the same mixing matrices distribution: σ (S) A ̸ = σ (T ) A. 3. When data are recorded with different devices, the recording conditions and noise might not be the same, resulting in different signal-to-noise ratio (SNR): σ (S) n ̸ = σ (T ) n.
4. Clinical outcomes e. g. , neuropsychological testing scores can be noisy. This noise could differ from one dataset to another: σ (S) ϵ ̸ = σ (T ) ϵ. Because of all those possible causes of variability in the model parameters, machine learning approaches may fail to provide good predictions across datasets. In this work, we focus on shifts that only affect the data, and we assume that the regression coefficients β j are the same for source and target. In particular, we are interested in understanding changes related to the mixing matrix and the variance of the statistical generators. The variability of these parameters across subjects and datasets affects the observed signals and results in variability in the data distribution. Below, we discuss which statistical methods could help reduce these different shifts between the data distributions of two different datasets.
Alignment methods We aim to learn a regression model from one dataset, the source domain, that will perform well on another, the target domain. As we focus on shifts affecting the data distribution, we investigate domain adaptation methods that align the source and the target distributions using geometrical transformations. The methods we chose for understanding and reducing dataset shifts are articulated in three alignment steps: re-centering, equalizing dispersion, and rotation correction. This choice was inspired by transfer learning methods used in Brain-Computer Interfaces (BCI) application and, more specifically, by the Riemannian Procrustes Analysis (RPA) of  (Rodrigues et al. , 2019). These steps can be used independently, usually by only re-centering the data, or combined. In the following, we detail these alignment functions in a general manner.
Step 1: re-centering. The most commonly used method of transfer learning on symmetric positive definite (SPD) matrices is to re-center each dataset in a common reference point on the Riemannian manifold  (Li et al. , 2021; Zanini et al. , 2018). This reference can be chosen as one of the domains' geometric mean or an arbitrary point on the manifold. Here we propose to re-center each domain to the Identity by whitening them with their respective geometric mean C(S) and C(T ) : h rct C(S) C (S) i = C(S)-1 2 C (S) i C(S)-1 2 (13) h rct C(T ) C (T ) i = C(T )-1 2 C (T ) i C(T )-1 2. ( 14 ) Differently put, re-centering applies separate whitening for source versus target data. This helps avoid errors in the tangent space projection when the average covariance is different for the source and target, e.
g. , because the mixing matrices are different, as in Figure  1  (B). This is a Riemannian equivalent of the centering step in classical z-scoring. Step 2: equalizing the dispersion. In this second step, the idea is to re-scale the covariances distribution around their mean C as illustrated in Figure  1 (C). We first compute the mean dispersion d of the covariances as the sum of the square distance between each matrix of the set and their geometric mean C over the number of samples in the dataset: d (S) = 1 N N i=1 δ 2 R C (S) i , C(S) (15) d (T ) = 1 N N i=1 δ 2 R C (T ) i , C(T ) , (16) with δ R the Riemannian distance defined in Equation  7. Then, we re-scale all covariances with 1 d so that the distribution has a dispersion of 1: h str d (S) C (S) i = C (S) 1 d (S) i (17) h str d (T ) C (T ) i = C (T ) 1 d (T ) i.
( 18 ) This is a Riemannian equivalent of the re-scaling step in classical z-scoring. By analogy, univariate rescaling of two groups modifies the data so that, e. g. a t-test would find its assumptions of equal variances met while not detecting any difference of means between the two datasets. Step 3: rotation correction. Until now, we have applied correction measures that process source and target data independently. This is not the case in this third step which implies shared information between source and target datasets. The rotation correction is the most delicate of the three steps. It requires estimating many more parameters than the others, and the source and target feature spaces must be the same size (P (S) = P (T ) = P ). In the literature, several methods for rotation estimation exist.
(26) In practice, this solution is found by computing the SVD of the product of the source and target tangent vectors Z (T ) Z (S)⊤ = U ⊤ SV , (27) and is R = VU ⊤. In this step, we include the information on which source point should be matched to which target point. It means the source and the target dataset should have the same number of observations (N (S) = N (T ) = N ) and be composed of "matching" observations (for example, the same set of subjects but different tasks/recording conditions/devices). We will refer to this method as paired. This step allows us to align source and target distributions in a shared space. The rotation correction is helpful when the mixing matrices are different between the domains (Fig. 1  (D)).
Benchmarks We conducted a first benchmark with simulated data to evaluate how the alignment steps can compensate for changes in the generative model parameters. We then applied the alignment steps to MEG data from the same dataset. In this benchmark, we used the different tasks performed by the subjects as domains. We first evaluated the methods using the same subjects in source and target but performing different tasks, and then used some subjects performing one task as the source domain and other subjects performing another task as the target domain. Finally, we evaluated whether the alignment makes it possible to generalize from one M/EEG dataset to another. The regression problem of these benchmarks is age prediction. It means we have no noise on the outcome as assumed in Section 2. 2.
M/EEG empirical benchmarks In the following empirical benchmarks, we focused on one MEG and two EEG datasets for evaluating our alignment methods with real-world data. We first describe these datasets and their preprocessing, then explain how we computed the covariance matrices of the signals. We followed the same preprocessing and processing steps as in  (Engemann et al. , 2022)  for the 'filterbank-riemann' pipeline. Finally, we detail the design of each benchmark.
Datasets Cam-CAN MEG data. The Cambridge Center of Aging and Neuroscience (Cam-CAN) dataset  (Taylor et al. , 2017)  consists of MEG recordings from a healthy population covering a wide age range. These data were recorded for each subject during resting state with eyes closed, an audio-visual (passive) task with visual and auditory stimuli presented separately, and a sensorimotor (smt) task with the same stimuli as the previous task combined with a manual response. All data were collected with the same 306-channel VectorView MEG system (Elekta Neuromag, Helsinki) with a sampling rate of 1 kHz.
Data processing and feature extraction After preprocessing, each filtered recording was segmented in 10 s epochs without overlap. Epochs were then filtered into seven frequency bands as defined in Table  3  as in  Engemann et al. (2022). We performed artifact rejection by thresholding extreme peak-to-peak amplitudes on single epochs using the local autoreject method  (Jas et al. , 2017). Subsequently, we computed covariance matrices from the set of artifact-free epochs with the Oracle Approximating Shrinkage (OAS) estimator  (Chen et al. , 2010). The ensuing regression pipeline, including all alignment steps, is illustrated in Figure  2. For MEG signals, the tSSS method reduces noise by projecting them in a subspace mainly containing the signal, leading to rank-deficient covariance matrices.
Tangent vectors Re-center Re-scale summarize the M/EEG recording by the covariance matrix after performing artifact cleaning (Section 3. 2. 1). The covariances computation, alignments steps, projection to the tangent space, and vectorization steps are done separately for seven frequency bands of Table  3. Alignment steps detailed in Section 2. 3 are computed from the covariance distribution across all subjects. The re-center and re-scale steps are performed separately for source and target datasets. The Procrustes steps combine information across source and target datasets. Finally, the seven resulting tangent vectors are concatenated to form one vector per subject used for regression.
Empirical benchmarks Cam-CAN (MEG): same subjects. For this benchmark, we used the experimental tasks of the Cam-CAN dataset for defining the different domains. Here, the source subjects were the same as the target subjects. Only the experimental task (e. g. , audiovisual VS audiovisual + motor) changed from one domain to the other. All subjects included underwent MEG recordings for both the source and the target domain. Therefore, importantly, the mixing matrix and the age distributions were the same for the source and target. As we dealt only with healthy participants, we aimed to minimize the error in age prediction when learning on one task (source domain) and predicting on another (target domain). To estimate standard deviation, we did a bootstrap with 100 repetitions. Cam-CAN (MEG): different subjects.
In this second benchmark on the Cam-CAN data, we again defined the different domains in terms of the experimental MEG tasks performed by the subjects. Yet, the critical difference with the previous benchmarks is that the source subjects and the target subjects were distinct persons. To implement this analysis, we randomly divided all Cam-CAN subjects into subsets of 80% forming the source subjects, and the left-out 20 % forming the target subjects. A stratification was performed by age decade to maintain similar age distributions between splits. We repeated this split with 100 different random initializations. TUAB & LEMON (EEG): different datasets. In this benchmark, we gauged the performance of alignment methods when the source and target domains are two different datasets. Here, the source domain was composed of data from TUAB, and the target one of data from LEMON.
Software We processed the M/EEG data with the open-source package MNE-Python  (Gramfort et al. , 2013) , MNE-BIDS  (Appelhoff et al. , 2019) , and the associated MNE-BIDS-Pipeline (https://mne. tools/mne-bids-pipeline/). The covariance matrices computation and the predictive pipeline were done with the coffeine library  (Sabbagh et al. , 2020)  (https://github. com/coffeine-labs/coffeine). The covariance matrices were manipulated in the alignment methods with the Pyriemann package  (Barachant et al. , 2022). Results analyses were performed with the Scikit-Learn software  (Pedregosa et al. , 2011).
M/EEG data We now examine the performance of alignment methods with M/EEG data. As with simulated data, the unpaired Procrustes method was not sufficiently robust and led to chance-level performance. We, therefore, do not report it in the following figures. Cam-CAN (MEG): same subjects. We first focused on a regression problem for which there was an individual noise on the mixing matrices, but their distribution was the same in source and target sets because the subjects were the same. It also implies that the age distribution was identical for both domains. The interest of this analysis  The regression model was trained on resting-state data, and predictions were made on the recordings of the somatosensory task. Re-centering the data led to slightly improved R 2 scores. Again, the re-scaling step did not lead to further improvements.
Cam tasks in non-overlapping samples of distinct subjects. As a consequence, the distributions of mixing matrices, necessarily, differed for the source and target domains. We performed a cross-validation in which 80% of the subjects were assigned to the source domain and 20% to the target domain. To keep relatively similar age distributions in the train and test splits, we did a stratification on the age decades of the subjects (cf StratifiedShuffleSplit of the Scikit-Learn software). Applying the paired rotation correction in this setup was no longer possible. Thus, it is impossible to analyze whether a rotation exists in the shift. We present the results of each alignment step in Figure  5. When covariance matrices were not aligned, generalizing from rest to passive tasks led to a R 2 score of 0.
, 2022)  (10-fold cross-validation on LEMON data only: 0. 54 ± 0. 13 represented by the dashed gray line). When both domains are re-centered to identity, we reached performances similar to when the model is trained on LEMON. Re-scaling did not visibly improve results. (B) Results when the regression model follows the SPoC approach. Not aligning led again to poor R 2 scores. Unlike the first panel, the z-score method improved the predictions similarly to re-centering. Re-scaling helped to reach performances on par with the Riemannian model trained on LEMON. and the target dataset is the smaller LEMON dataset (n=213). TUAB also has a broader age range. This way, the regression model will be asked to predict age values that fall within the range observed during model training. We performed a bootstrap with 2000 iterations on TUAB data.
Discussion In this study, we thoroughly explored domain adaptation methods that align M/EEG covariance matrix distri-butions for regression problems on both simulations and large datasets. We considered methods from BCI applications  (Bleuzé et al. , 2021; Maman et al. , 2019; Rodrigues et al. , 2019)   et al. , 2022). The re-centering step is simple to implement and has already been very effective in BCI classification to deal with variability between sessions  (Barachant et al. , 2013)  but also between subjects  (Zanini et al. , 2018). Our results suggest it is also effective in a regression context with variability between populations, tasks, and recording devices. We extended our evaluation of the impact of alignment methods on different EEG datasets to the SPoC model  (Dähne et al. , 2014).
In this setting, the z-score method and re-centering performed both equally better than no alignment. Interestingly, re-scaling was beneficial and helped to reach performance close to the Riemannian model trained on LEMON. By inspecting the SPoC patterns and the associated log powers, we demonstrated that the observed gain in the performance of re-centering was enabled by more similar log powers between source and target than without alignment. In other words, data alignment adapts the target features to the regression equations fitted on the source data, which explains generalization. Unfortunately, the two last benchmarks are missing a rotation correction method. As Procrustes paired led to an apparent score increase in the first benchmark, we ex-pect a rotation correction to be beneficial in the other benchmarks.
The dimensionalities of the source and the target data must be equal to apply the predictive model to it. It has been proposed to deal with different dimensionalities of covariance matrices via zero-padding  (Rodrigues et al. , 2020). However, this method is not applicable if there is no rotation correction afterward, so we could not use it. We also observed that our framework is not robust to sensor permutation in the covariance matrices, even with the same sets of sensors. In our EEG benchmark, we had to select the common channels between the two datasets and sort them to reach acceptable performance even for the re-center step. In addition to leading to a gain in performance, having a proper rotation correction would help to deal with issues related to different numbers or types of sensors in the source and target datasets.
Data and code Availability All data used are publicly available. The Cam-CAN data repository is accessible via http://www. mrc-cbu. cam. ac. uk/datasets/camcan/, the TUH EEG data corpus via https://isip. piconepress. com/projects/tuh_ eeg/ and the Leipzig Mind-Brain-Body database via https: //fcon_1000. projects. nitrc. org/indi/retro/MPI_LEMON/ downloads/. The scripts and code for the alignment methods and the results presented in this paper are available on GitHub (https://github. com/apmellot/harmonizing_ aligning_meeg).
of 1385 subjects (female = 775 and male = 610) with ages between 0 and 95 years (mean = 44. 4 years and std = 16. 5 years). Preprocessing: Data were band-pass filtered between 0. 1 and 49 Hz with a zero-phase finite impulse response (FIR) filter using the firwin with Hamming window featuring a 0. 0194 passband ripple, 53 dB stopband attenuation, a 0. 1 Hz lower transition bandwidth and a 12. 25 Hz upper transition bandwidth, and a filter length of 6601 samples (33. 005 s). Data were then resampled to 200 Hz. We selected a subset of 21 channels common to all recording devices used in this dataset. When several recordings were available for one patient, we picked the first to get only one recording per subject. LEMON EEG data. The Leipzig Mind-Brain-Body database provides multimodal data from healthy groups of young and elderly subjects (Babayan et al.
, 2019). In our benchmark, we only used EEG recordings from this dataset. They were recorded with a 62-channel ActiCAP device and sampled at 2500 Hz. Each subject did two recordings at rest with two conditions: eyes closed and eyes open. Sample description: We included 213 subjects from the LEMON database in our benchmark. No selection criteria were applied, and we kept the data for which the processing and the feature extraction were successful. This led to a cohort with 134 males and 79 females aged from 20 to 77 years. The age distribution of the LEMON presents a peculiarity: it is split into two separate age groups, one with individuals being between 20 and 35 years old and the second between 55 and 77 years old.
, the filterbank-riemann pipeline trained on LEMON data only with a 10-fold cross-validation led R 2 scores of R 2 = 0. 54 ± 0. 13. Here, the training dataset only consisted of data from the TUAB dataset. The Riemannian re-center step made it possible to reach performance comparable to a model trained within the same dataset. With SPoC (B), re-centering led to a reduced standard deviation compared to no alignment. The highest R 2 scores were achieved when the re-scaling step was added to the alignment procedure and almost reached the performance of the Riemannian model trained on LEMON. Aligning the covariances distribution helped improve prediction performance even with a regression model like SPoC that does not leverage the geometry of the covariance matrices. This observation motivated an examination of how alignment affects the SPoC patterns, the inverse of the SPoC spatial filters W SPoC , and the resulting powers.
articulated in three alignment steps: re-center the geometric means, equalizing dispersions, and rotation correction. These alignment steps are evaluated in the regression context of generalizing age prediction across different domains. We investigated how dataset shifts can occur by analyzing a statistical generative model of M/EEG data. We presented simulated dataset shift scenarios based on this model for which alignment steps can effectively compensate the shift, plus a noise scenario to get a sense of how the methods would perform with real data. The simulation results showed that Procrustes paired is the most effective method in all scenarios. It was expected as it includes the three alignment steps and a rotation correction informed by the pairing of source and target subjects. We then designed M/EEG benchmarks with different domain definitions to determine the alignment methods' efficiency in those various settings.
In the first benchmark on Cam-CAN data, the source and target subjects were the same, but we still observed that re-centering and Procrustes paired led to better scores. On the other hand, equalizing their dispersions did not bring clear gains in performance in any benchmark. In the Cam-CAN benchmarks, the scores reached when the subjects are different in the domains are distinctly lower than with the same subjects: the shift is bigger (lower no alignment baseline) and harder to recover. For the EEG benchmark, we used the TUAB dataset as the source and the LEMON dataset as the target. Here, all recordings were done at rest but with different recording devices and in different populations. Re-centering the distributions in the EEG benchmark exceeded our expectations. Re-centering was sufficient to recover performance close to what is reached when training the Riemannian model on LEMON (Engemann.
Statistical climate reconstruction techniques are fundamental tools to study past climate variability from fossil proxy data. In particular, the methods based on probability density functions (or PDFs) can be used in various environments and with different climate proxies because they rely on elementary calibration data (i. e. modern geolocalised presence data). However, the difficulty of accessing and curating these calibration data and the complexity of interpreting probabilistic results have often limited their use in palaeoclimatological studies. Here, I introduce a new R package (crestr) to apply the PDF-based method CREST (Climate REconstruction SofTware) on diverse palaeoecological datasets and address these problems. crestr includes a globally curated calibration dataset for six common climate proxies (i.