Unsupervised representation learning of spontaneous MEG data with nonlinear ICA
Full text
This is a self-archived version of an original article. This version may differ from the original in pagination and typographic details. Author(s): Title: Year: Version: Copyright: Rights: Rights url: Please cite the original version: CC BY-NC-ND 4.0 https://creativecommons.org/licenses/by-nc-nd/4.0/ Unsupervised representation learning of spontaneous MEG data with nonlinear ICA © 2023 The Author(s). Published by Elsevier Inc. Published version Zhu, Yongjie; Parviainen, Tiina; Heinilä, Erkka; Parkkonen, Lauri; Hyvärinen, Aapo Zhu, Y., Parviainen, T., Heinilä, E., Parkkonen, L., & Hyvärinen, A. (2023). Unsupervised representation learning of spontaneous MEG data with nonlinear ICA. Neuroimage, 274, Article 120142. https://doi.org/10.1016/j.neuroimage.2023.120142 2023
NeuroImage 274 (2023) 120142 Contents lists available at ScienceDirect NeuroImage journal homepage: www.elsevier.com/locate/neuroimage Unsupervised representation learning of spontaneous MEG data with nonlinear ICA Yongjie Zhu a , b , ∗ , Tiina Parviainen c , Erkka Heiniläc , Lauri Parkkonen b , Aapo Hyvärinen a a Department of Computer Science, University of Helsinki, 00560 Helsinki, Finland b Department of Neuroscience and Biomedical Engineering, Aalto University, 00076 Espoo, Finland c Centre for Interdisciplinary Brain Research, Department of Psychology, University of Jyväskylä, 40014 Jyväskylä, Finland a r t i c l e i n f o Keywords: Nonlinear independent component analysis (ICA) Unsupervised learning Deep generative model Resting-state network Non-stationarity Neurofeedback Magnetoencephalography (MEG) a b s t r a c t Resting-state magnetoencephalography (MEG) data show complex but structured spatiotemporal patterns. However, the neurophysiological basis of these signal patterns is not fully known and the underlying signal sources are mixed in MEG measurements. Here, we developed a method based on the nonlinear independent component analysis (ICA), a generative model trainable with unsupervised learning, to learn representations from restingstate MEG data. After being trained with a large dataset from the Cam-CAN repository, the model has learned to represent and generate patterns of spontaneous cortical activity using latent nonlinear components, which reflects principal cortical patterns with specific spectral modes. When applied to the downstream classification task of audio-visual MEG, the nonlinear ICA model achieves competitive performance with deep neural networks despite limited access to labels. We further validate the generalizability of the model across different datasets by applying it to an independent neurofeedback dataset for decoding the subject’s attentional states, providing a real-time feature extraction and decoding mindfulness and thought-inducing tasks with an accuracy of around 70% at the individual level, which is much higher than obtained by linear ICA or other baseline methods. Our results demonstrate that nonlinear ICA is a valuable addition to existing tools, particularly suited for unsupervised representation learning of spontaneous MEG activity which can then be applied to specific goals or tasks when labelled data are scarce. 1. Introduction Over the last decades, spontaneous (or resting-state) brain activity has attracted a great amount of interest in the neuroscience community. It has been demonstrated to be not random but organized into complicated spatiotemporal patterns, measurable for example by magnetoencephalography (MEG) ( Brookes et al., 2011 ; De Pasquale et al., 2010 ; Vidaurre et al., 2018 ) and electroencephalography (EEG) ( Mantini et al., 2007 ). While the origins and the electrophysiological basis of restingstate activity remain largely unclear ( Brookes et al., 2011 ; Mantini et al., 2007 ), from a purely data-driven perspective, they can be related to individual differences ( Becker et al., 2020 ; Sareen et al., 2021 ) or neurological diseases ( Fox et al., 2014 ; Zhu et al., 2021 ), for example. In a data-driven approach, co-activation across anatomically separated regions, manifested as temporal correlations, can be used to delineate functional networks. More sophisticated methods use the non- Gaussian structure of the data in the form of linear independent component analysis (ICA) or blind source separation. For resting-state MEG recordings, linear ICA finds a number of components, which may re- ∗ Corresponding author. E-mail addresses: yongjie.zhu@helsinki.fi (Y. Zhu), aapo.hyvarinen@helsinki.fi (A. Hyvärinen) . flect head motion, non-neuronal physiology, and unconstrained cognition. ( Hyvärinen et al., 2010 ; Vigário et al., 2000 ). This is an important step forward since ICA can find components in the MEG recordings that would otherwise be difficult to extract. However, these components explain only part of the resting-state activity and may be entangled not only among themselves but with further activity not found by ICA. Linear separation is, in fact, limited and it may be that we need to consider, for example, correlations of the amplitudes in rhythmic activity ( Brookes et al., 2011 ). While for some known nonlinearities, such as power coherence, we may be able to preprocess the data so that linear ICA is enough, the field would benefit from data-driven methods that can uncover and disentangle any hidden spatiotemporal structures from spontaneous electrophysiological data themselves, without having to assume we know the nonlinearities involved. To be effective, such a method should also be able to infer the components or sources from resting-state MEG data, while being able to account for complicated and nonlinear relationships. The aforementioned requirements point us to deep learning or representation learning with deep neural networks ( LeCun et al., 2015 ). For https://doi.org/10.1016/j.neuroimage.2023.120142 . Received 27 September 2022; Received in revised form 26 April 2023; Accepted 27 April 2023 Available online 28 April 2023. 1053-8119/© 2023 The Author(s). Published by Elsevier Inc. This is an open access article under the CC BY-NC-ND license ( http://creativecommons.org/licenses/by-nc-nd/4.0/ )
Y. Zhu, T. Parviainen, E. Heinilä et al. NeuroImage 274 (2023) 120142 brain imaging, deep learning has been increasingly applied as a generic class of machine-learning tools to learn features and classifiers from neuroimaging data ( Acunzo et al., 2022 ; Yan et al., 2022 ; Zubarev et al., 2019 ). Most applications are within the scope of supervised learning. Typically, a deep neural network model is trained using neuroimaging data as input to give rise to an output that optimally matches the ground truth for a task, such as brain-age prediction ( Cole et al., 2017 ; Jónsson et al., 2019 ), emotion recognition ( Hsu et al., 2022 ), and pathology detection ( Aoe et al., 2019 ). However, resting-state data do not include any labels or annotations needed for such supervised learning paradigms. They may be obtained after data collection, e.g., by expert labeling, which is often costly and the number of labels typically remains several orders of magnitude smaller than the data points in the MEG data ( Banville et al., 2021 ; Schirrmeister et al., 2017 ). In addition, it is uncertain to what extent representations learned for a specific task would be generalizable (i.e., transferable) to other tasks. It is also debatable whether deep neural networks with supervised learning are currently superior to more conventional and simpler methods ( He et al., 2020 ). However, for MEG and EEG, unlabeled data are available in abundance, in particular in the form of resting-state data. This opens up the possibility of using unsupervised versions of deep learning where no labels are needed. Such methods should uncover the underlying nonlinear sources that drive intrinsic brain activity regardless of any task or stimuli. The recently proposed Nonlinear ICA ( Hyvärinen and Morioka, 2016 ), a nonlinear version of ICA, can be an alternative method for finding such hidden nonlinear sources that generate the data with the unsupervised paradigm. While nonlinear ICA is an ill-defined problem in general, it is identifiable and can be estimated, for example with self-supervised learning (SSL), under certain assumptions. SSL is a particular unsupervised learning approach to learning representations from unlabeled data using some additional structure in the data to provide an artificial supervisory signal. Thus one transforms an unsupervised learning problem into a supervised one, called the ‘pretext’ task. ( Jing and Tian, 2020 ). Finding such general-purpose features without labels also opens up the way to semi-supervised learning. This means that we learn the features or components from a large unlabeled data set (e.g., a resting-state activity database) and then use those features for a classification task of interest, such as diagnosis or neurofeedback, with a dataset that has limited labels available. Typically, in the terminology of SSL, there is a ‘pretext’ and a ‘downstream’ task. Downstream tasks are tasks that people are actually interested in, but with limited or no annotations (labels). The pretext task, on the other hand, is the core of the SSL approach and it must be sufficiently associated with the downstream task so that similar features should be used to carry it out ( Banville et al., 2021 ). Importantly, it must also be possible to generate the annotations for this pretext task using the large unlabeled data alone. In addition to facilitating the downstream task and/or reducing the number of labeled samples necessary, self-supervised learning can also discover more general and robust representations than those learned in supervised learning with specific tasks or goals ( Banville et al., 2021 ; Van den Oord, Li, and Vinyals, 2018 ). In this study, we chose to use the recently proposed nonlinear independent component analysis (ICA) estimated by SSL technique ( Hyvärinen and Morioka, 2016 ; Morioka et al., 2021 ) for unsupervised deep learning. We apply nonlinear ICA to a very large resting-state MEG data set ( Shafto et al., 2014 ; Taylor et al., 2017 ), without requiring any labels or narrowly focusing on any downstream task. Nonlinear ICA is a generative model capable of learning the identifiable features that generate the data, and it provides a well-defined and interpretable model. Nonlinear ICA is also promising based on the earlier success of linear ICA in neuroimaging data analysis. Briefly, in this study, two kinds of nonlinear ICA models are used, both using self-supervised learning. One is a basic nonlinear ICA version based on time contrastive learning (TCL) building on non-stationarity ( Hyvärinen and Morioka, 2016 ). The other one is independent innovation analysis (IIA) which extends TCL for temporally correlated time series ( Morioka et al., 2021 ). To enable group-level analysis, we further propose group nonlinear ICA for resting-state MEG from multiple subjects based on a multi-task learning scheme. Specifically, nonlinear ICA is trained using a group-shared nonlinear feature extractor which outputs a set of feature values from a morphed parcel time series of each subject, so as to optimize the selfsupervised classification performance of subject-specific multinomial logistic regression (MLR) classifiers ( Fig. 1 B). We then characterize the spatiotemporal and spectral profiles of the latent components learned from resting-state MEG. We show how the representation enables high performance in a simple down-stream classification of visual/auditory decoding task in MEG data from the same population. Lastly, we demonstrate the capability of transferring the representation to a different dataset from a different subject population: we validate the use of the features given by the trained nonlinear ICA model showing how they lead to superior decoding accuracy of attentional states from ongoing MEG data ( Zhigalov et al., 2019 ). 2. Materials and methods 2.1. Overview of the methods Typically, a generalizable system for representation learning of brain imaging data such as MEG consists of a base module and additional projection modules ( Banville et al., 2021 ; Kim et al., 2021 ). The base module is trained with unsupervised or self-supervised learning from taskfree resting-state (spontaneous) MEG. Therefore, the base module is not tailored to any specific purpose, such as brain age prediction or pathological detection, or any specific task related to cognitive activity. After training, the base module is supposed to be capable of generalization to MEG data in different cognitive task conditions or downstream (classification) tasks, in particular through additional projection modules. The representation learned by the base model can be used by the projection modules which are trained to meet a specific task by supervised learning. It is expected that the base module is designed and trained with a deep architecture to leverage a large number of unannotated (unlabeled) data, whereas the projection modules can be shallow and trained with limited labeled data. Such a semi-supervised scheme makes the learning more efficient since unannotated data are much more abundant than annotated data. In such a scheme, nonlinear ICA ( Hyvärinen and Morioka, 2016 , 2017 ; Morioka et al., 2021 ) offers a suitable model for the initial part of the base module, which is composed of feature extractor or additional linear unmixing matrix as Fig. 1 shows. The feature extractor is learnable with self-supervised learning and the linear unmixing matrix is learnable with unsupervised learning without any label data ( Fig. 1 B). Unsupervised learning with nonlinear ICA can leverage the ever-increasing amount of resting-state MEG data ( Larson-Prior et al., 2013 ; Nisoet al., 2016 ; Shafto et al., 2014 ). The latent components or representations extracted from nonlinear ICA can be input to specific projection modules (e.g., linear SVM) to facilitate downstream tasks such as classification of cognitive task and decoding the mental state ( Fig. 1 C). 2.2. Nonlinear independent component analysis Nonlinear ICA is a recently proposed unsupervised learning framework based on a nonlinear generalization of the well-known basic ICA ( Hyvärinen and Morioka, 2016 ). It promises a principled approach to representation learning, for example using deep neural network, and attempts to find nonlinear components, in multidimensional data. In the following, we briefly explain the basic principles of nonlinear ICA, but we emphasize that we use algorithms that have been previously published by Hyvärinen and Morioka (2016) , Morioka et al. (2021) and refer the reader to those publications for a detailed description. 2
Y. Zhu, T. Parviainen, E. Heinilä et al. NeuroImage 274 (2023) 120142 Fig. 1. The proposed approach. A. The generative model is basically a nonlinear version of ICA. The observed time series are given by a nonlinear transformation of the components, which are mutually independent, and have segment-wise stationarity, which is a simple form of non-stationarity. B. In TCL, we attempt to train a feature extractor 𝐡 ( 𝒙 , 𝜽) to be sensitive to the nonstationarity of the data by using a multinomial logistic regression which attempts to discriminate between the segments, labelling each data point with the segment label 1,…,T (as pretext task) for each subject (e.g. 𝜏= 1 𝑖 , …, 𝑇 𝑖 with subject 𝑖 ). The segments from all subjects are fed into the feature extractor. Note that different subjects are likely to show uninteresting technical differences in group-level analysis. Therefore, we apply a multi-task (multi-subject) learning scheme, which includes a separate top-layer MLR classifier for each subject, but a shared feature extractor (here, a multilayer perceptron, MLP). After training, feature extractor was followed by a linear ICA to resolve the linear indeterminacy and finally obtain components up to point-wise nonlinearities such as squaring. C. The feature extractor 𝐡 ( 𝒙 , 𝜽∗ ) trained on big unlabeled data and the linear unmixing matrix, as a base module, are applied to downstream tasks with label-limited data. In general, nonlinear ICA assumes a generative model ( Fig. 1 A): 𝐱 ( 𝑡 ) = 𝐟 ( 𝐬 ( 𝑡 ) ) (1) where 𝐱( 𝑡 ) is the observed n -dimensional data point at time t , 𝐟is an invertible and smooth mixing function to be learned from the data, 𝐬 ( 𝑡 ) is the m -dimensional vector of independent components 𝑠 𝑖 ( 𝑡 ) , and m being the number of components. 1 The time series 𝑠 𝑖 are presumed to be mutually independent. While nonlinear ICA is an ill-defined problem in general ( Hyvärinen and Pajunen, 1999 ), recent work has proposed an identifiable solution using some additional auxiliary information about the data, such as their temporal structure ( Hyvärinen and Morioka, 2016 , 2017 ). The estimation of nonlinear ICA is to find out the underlying sources (components) 𝒔 ( 𝑡 ) in Eq. (1) by learning an unmixing function 𝐠 (i.e., 𝐠 = 𝐟 −1 ) such that 𝒔 ( 𝑡 ) = 𝐠 ( 𝒙 ( 𝑡 ) ) , (2) which can be solved (learned) by time-contrastive learning (TCL) method based on the assumption that the sources are independent and temporally non-stationary (see Section 2.2.1 ). 1 While the basic form of nonlinear ICA based on time-contrastive learning (TCL) considers m = n , it is also possible to have m < n in TCL, as pointed out at the end of Supplementary Material ("Dimension Reduction") of Hyvärinen and Morioka (2016) . In practice, this is simply accomplished by having a smaller number of features in the neural network (feature extractor), and no other changes to the procedure are needed ( Fig. 1 B). 2.2.1. Time-contrastive learning Time-contrastive learning (TCL) is a novel self-supervised learning technique capable of estimating the nonlinear ICA model based on a non-stationarity assumption ( Hyvärinen and Morioka, 2016 ). The starting point in TCL is to assume that each component is non-stationary, which makes the problem well-defined and the model identifiable. The intuitive rationale is that if the components are non-stationary, forcing them to be independent at every segment gives many more constraints than just a single, global constraint of independence as in ordinary linear ICA based on non-Gaussianity. That justifies to some extent why we obtain identifiability. We also note that the definition of the model imposes non-stationarity on the components, but this necessarily implies that the data are non-stationary as well, since the mixing is purely spatial. The non-stationarity is assumed to be much slower than the sampling rate; in other words, the time-series can be divided into segments in each of which the distributions are approximately constant; but crucially, the distribution is different across segments because of the non-stationarity. Accordingly, TCL assumes conditional (segment-wise) independence of the components, instead of marginal independence assumed in ordinary ICA. It was proven that such temporal structure, called time-segment- wise stationarity, enables the estimation of the source signals up to component-wise nonlinearities ( Hyvärinen and Morioka, 2016 ). Assume the data has been segmented, by a method to be specified. Denote the segment index by 𝜏= 1 , …, 𝑇 , where T is the number of segments, the statistical distribution of each underlying component 𝑠 𝑖 within each segment can be modelled as an exponential family: log 𝑝 𝜏(𝑠 𝑖 )= log 𝑞 𝑖, 0 (𝑠 𝑖 )+ 𝑘 ∑ 𝑗=1 𝜆𝑖,𝑗 ( 𝜏) 𝑞 𝑖,𝑗 (𝑠 𝑖 )− log 𝑍 𝑖 (𝜆𝑖, 1 ( 𝜏) , …, 𝜆𝑖,𝑘 ( 𝜏) ), (3) 3
Y. Zhu, T. Parviainen, E. Heinilä et al. NeuroImage 274 (2023) 120142 where 𝑝 𝜏is the probability density function (pdf) of segment 𝜏, 𝑞 𝑖, 0 is a stationary base density and 𝑞 𝑖,𝑗 with 𝑗 ≥ 1 are the sufficient statistics for the exponential family of the component 𝑠 𝑖 (the index 𝑡 is dropped for simplicity), and 𝑍 𝑖 is the normalization constant. Note that the parameters 𝜆𝑖,𝑗 ( 𝜏) of source 𝑠 𝑖 depend on the segment index 𝜏,which creates the nonstationary sources. TCL learns the inverse transformation 𝐠 = 𝐟 −1 (in Eq. (2) ) with SSL paradigm. The pre-text task in such SSL is to classify original data points with the corresponding segment indices used as class label, using multinomial logistic regression (MLR). For this reason, TCL adopts a deep neural network including a feature extractor 𝐡 ( 𝒙 ( 𝑡 ) , 𝜽) followed by MLR for label prediction, where 𝜽is the neural network weights. Thus, it seems intuitively clear that in order to optimally classify observations 𝒙 ( 𝑡 ) into their corresponding segment labels 𝜏, the feature extractor 𝐡 ( 𝒙 ( 𝑡 ) , 𝜽) needs to learn a useful representation of the temporal structure in the underlying distribution of latent sources. The theory of TCL indicates that the method can learn the latent components 𝒔 ( 𝑡 ) up to pointwise nonlinearities given by the 𝑞in Eq. (3) ( 𝑞is typically squaring or absolute values function) and a linear transformation 𝐀 ; that is, for example, 𝒔 ( 𝑡 ) 2 = 𝐀𝐡 ( 𝒙 ( 𝑡 ) ) , where 𝐡 ( 𝒙 ( 𝑡 ) ) is the feature extractor to be learned by TCL just like de-mixing the nonlinear part of Eq. (1) and 𝐀 is the linear mixing part left in the model (see Fig. 1 B). In other words, we can obtain the 𝒔 ( 𝑡 ) up to point-wise squaring by learning the nonlinear unmixing function 𝐠 via TCL training (the nonlinear part, 𝐡 ( 𝒙 ( 𝑡 ) ) ) and a further linear ICA (the linear part, 𝐀 ). This is quite surprising since the self-supervised method makes no reference to independent components. A further linear ICA can estimate the remaining linear mixing 𝐀 if the number of segments increases to infinity and the data distributions of segments are random in a certain sense. Therefore, the theory proves that TCL (with a further linear ICA) is consistent in the sense of estimation theory: when the amount of data points grows infinitely, the method finds out the right independent components up to the point-wise nonlinearities. This statistical theory assumes that the optimization does not fail by getting trapped in a local optimum; however, this is a typical practical problem in deep learning which is addressed further in our discussion. In more detail, the self-supervised TCL algorithm proceeds as follows: (1). Divide a multivariate time series 𝐱( 𝑡 ) into segments, i.e. time windows, indexed by 𝜏= 1 , …, 𝑇 . Any temporal segmentation method can be used, e.g. simple equal-sized bins. For multi-subject learning, time series are labeled separately for each subject, e.g. 𝜏= 1 𝑖 , …, 𝑇 𝑖 with subject 𝑖 ; (2). Associate each data point with the corresponding segment index 𝜏in which the data point is contained; i.e. the data points in the segment 𝜏are all given the same segment label 𝜏; (3). Learn a feature extractor 𝐡 ( 𝒙 ; 𝜽) together with MLRs to classify all data points with the corresponding segment labels 𝜏used as class labels, as defined above. These procedures are demonstrated in the Fig. 1 B. The purpose of the feature extractor is to extract a feature vector that enables the MLRs to discriminate the segments. Therefore, it seems intuitively clear that the feature extractor needs to learn a useful representation of the temporal structure of the data, in particular the differences of the distributions across segments. Note that different subjects are likely to show uninteresting technical differences for group-level analysis. We thus apply a multi-task (multi-subject) learning scheme, which includes a separate top-layer MLR classifier for each subject, but a shared feature extractor ( Fig. 1 B). After TCL training is finished, the extracted components are followed by linear ICA, which is applied to disentangle the linear indeterminacy left by the feature extractor part of TCL, finally giving the estimates of the independent components 𝐬 ( 𝑡 ) up to point-wise nonlinearities such as squaring. In other words, the inverse of function 𝐟(i.e., 𝐠 in Eq. (2) ) is learned via TCL with further linear ICA, corresponding to feature extractor 𝐡 ( 𝒙 ; 𝜽) and additional linear unmixing matrix. Such basic nonlinear ICA with TCL estimation is called NICA(TCL) in the current study. 2.2.2. Independent innovation analysis Independent innovation analysis (IIA) can be considered an extension of the nonlinear ICA framework for a nonlinear vector autoregressive process where instead of the actual times series, their innovations at each time point are decomposed to independent components ( Morioka et al., 2021 ). This general model (a first-order autoregressive process is assumed here merely for simplicity of exposition) can be written as: 𝐱 ( 𝑡 ) = 𝐟 ( 𝐱 ( 𝑡 − 1 ) , 𝐬 ( 𝑡 ) ) (4) where 𝐱( 𝑡 − 1 ) is the time-delayed time series of 𝐱( 𝑡 ) , and 𝐬 ( 𝑡 ) represents the independent innovations (components). 2 The IIA model in Eq. (4) can be transformed into a form similar to Eq. (1) as: [ 𝒙 ( 𝑡 ) 𝐱 ( 𝑡 − 1 ) ] = 𝐟 ( [ 𝐬 ( 𝑡 ) 𝐱 ( 𝑡 − 1 ) ] ) (5) where 𝐟 is the augmented model, which includes the original model 𝐟 in the half of the space, and an identity mapping of 𝐱( 𝑡 − 1 ) in the remaining subspace. Importantly, this augmentation does not impose any particular constraint on the original model. Thus, this augmented model can then be solved using nonlinear ICA theory. The nonlinear vector autoregressive model provides an appealing framework to analyze multivariate time series obtained from a nonlinear dynamical system. In this study, we use a TCL-based version of IIA ( Morioka et al., 2021 ), which we call NICA(IIA). It can guarantee the identifiability of the innovations with arbitrary nonlinearities, up to a permutation and component-wise invertible nonlinearities under certain assumptions. Note that there is no linear indeterminacy left after TCL for IIA and no further linear ICA is thus required after IIA has been performed (Fig. S1). 2.3. Datasets We use a large MEG data set from the Cam-CAN repository to train nonlinear ICA models, which can learn an optimal representation of data. We then explore and visualize the latent representation. Next, in an investigation of the transfer of the features to other data sets, we validate the generalization of the representations on an independent neurofeedback dataset. 2.3.1. Cam-CAN dataset We primarily analyzed data from the open-access Cambridge Center for Aging Neuroscience (Cam-CAN) repository (see Shafto et al. (2014) , Taylor et al. (2017) ) for details of the dataset and acquisition protocols). Specifically, we used the resting-state and passive audio-visual task MEG data from 652 healthy subjects (male/female = 322/330, mean age = 54.3 ± 18.6, age-range 18–88 years), and their structural (T1-weighted MRI) neuroimaging data for source reconstruction. The MRI images were acquired with a 3T Siemens of scanner with a 32- channel head coil. The MEG data were recorded using a 306-channel Elekta Neuromag Vectorview (102 magnetometers and 204 planar gradiometers; MEGIN Oy, Helsinki, Finland) at a sampling rate of 1 kHz. For the 9-min resting-state measurement, subjects were asked to lie still and remain awake with their eyes closed. We discarded the initial and final 30 s and used the remaining 8 min of data from each subject for further analysis and model training. In the task MEG, subjects were presented with 120 trials of unimodal stimuli (60 visual stimuli: bilateral/full-field circular checkerboards; 60 auditory stimuli: binaural tones at one of three equiprobable frequencies) at a rate of approximately 1 per second. Following exclusions (e.g., 2 Similar to TCL on nonlinear ICA, the basic form of IIA based on TCL considers m = n , it is also possible to have m < n , and this is simply accomplished by having a smaller number of features in the feature extractor (Fig. S1B). 4
Y. Zhu, T. Parviainen, E. Heinilä et al. NeuroImage 274 (2023) 120142 subjects that did not have both MRI and MEG data, unsatisfactory preprocessing results such as failure to remove cardiac and ocular artifacts, and/or failure to extract the cortical surface for source reconstruction), a final dataset of 610 subjects was retained for further analysis. 2.3.2. Mental-states dataset As an example of the utility of the nonlinear ICA performed, we analyzed a dataset (also recorded by a similar MEG device) from our earlier study ( Zhigalov et al., 2019 ), where we attempted to decode attentional states – mindfulness or wandering thoughts –from ongoing MEG brain activity. Briefly, we used MEG data from 24 healthy subjects (9 females, 15 males, 27 ± 5.5 years (mean ± SD)), previously recorded in the following experimental paradigm. After a 2-min rest period, participants were instructed to perform one of the tasks while undergoing MEG. The tasks were organized into 2-min blocks in a counterbalanced order and the participants performed each task four times in a single session. The session ended with a 2-min rest block. Two sessions per participant were conducted with a 5-min break between the sessions. Due to the great difficulty of experimentally inducing mind wandering, the experimental data we used here was based on "simulated mind wandering", which means tasks that create brain activity that is not very different from mind wandering. The tasks were mindfulness meditation (MF), reflection on future planning (FP) and reflection on anxiousness-inducing emotional pictures (EP). In particular, the conditions of reflection on future planning (FP) and reflection on anxiousnessinducing emotional pictures (EP) are simulating mind wandering. In all tasks, subjects were instructed to sit still, fix the gaze on the crosshair, and perform a task after a short (7 s) visual instruction. The visual instruction was shown at the beginning and at the middle of each task to keep subjects’ attention. Based on these responses, the subjects’ focus was considered reasonably good by ( Zhigalov et al., 2019 ), but we do not analyze them any further. For the mindfulness meditation task, the participant was instructed to focus attention on the sensations of breathing and move the focus of attention back to the task if mind-wandering occurs. For future planning and anxiety-inducing tasks, the participant individually selected 16 (out of 40) relevant pictures prior to the experiment. In the future planning task, the participant was asked to perform planning related to the picture, presumably following the ensuing chains of thought and keeping his/her mind busy. The anxiety-inducing task was similar to the future planning, but instead of neutral pictures, disturbing, scary, disgusting, or other unpleasant pictures were presented to the participant. 2.4. Preprocessing Since the Cam-CAN and our mental-states MEG data were both recorded by 306-channel Elekta Neuromag Vectorview, the preprocessing was similar. The MaxFilter software (MEGIN Oy, Helsinki, Finland) with temporal signal space separation (tSSS) was applied to suppress external magnetic interference and compensate for head movements ( Taulu and Simola, 2006 ). Thereafter, the MEG data were processed using the open-source software MNE-Python ( Gramfort et al., 2014 ). MEG data were band-pass filtered to 0.1–40 Hz, and resampled at 256 Hz, as a wider band and higher sampling rate did not significantly improve the performance while increasing computational time. Cardiac and eye movement artifacts were identified using the FastICA algorithm implemented in MNE-Python and automatically classified by comparing the ICA components with the simultaneously recorded electrocardiography (ECG) and electrooculography (EOG) signals ( Jas et al., 2018 ). The FreeSurfer software ( http://surfer.nmr.mgh.harvard.edu/ ) was used for volumetric segmentation of MRI data, cortical surface reconstruction and flattening, cortical parcellation, and neuroanatomical labeling with the Schaefer atlas ( Schaefer et al., 2018 ). The MNE software was used to create head conductor models and cortically constrained source space based on the anatomical information provided by FreeSurfer, for the MEG-MRI co-registration, and for the preparation of the forward and inverse operators. The sources were constrained within the cortex and assumed to be perpendicular to the local cortical surface. The reconstructed cortical surface was decimated to 4098 evenly distributed vertices per hemisphere with 4.9 mm spacing. Depth-weighted L2-minimum-norm estimate was computed for all current dipoles with a loose orientation of 0.2. The noise covariance matrix was estimated from the empty-room recordings and the inverse solution was noise-normalized. The cortex and thus the source space was divided into 400 Schaefer-parcels for each subject. For each parcel, we performed a principal component analysis to extract spatially orthogonal components that describe the activity, ordered by amount of variance explained. We selected the first principal component as a representation of the parcel’s time course of activity. For group-level analysis, the subjects’ parcel time series were morphed into a standard atlas, and then temporally concatenated across subjects. For the neurofeedback dataset, the cortical sources were reconstructed using a similar pipeline but with an averaged MRI template since we did not obtain the individual structural MRI of these subjects. 2.5. Feature extractor and nonlinear ICA training We used a multilayer perceptron (MLP) as the feature extractor that takes a single point in the parcel time-series as input and nonlinearly extracts component activity, for both NICA(TCL) and NICA(IIA). The network consists of concatenated (stacked) hidden layers each followed by nonlinear activation units. NICA(TCL) settings: We set the number of layers as L = 3 since our preliminary study showed that a three-layer network gives optimal classification accuracies during the training. We fixed the number of nodes as 80 in the first hidden layer, and 40 in the second hidden layer. The number of nodes in the output layer was equal to the number of components. We tried different values for the number of nodes in the output layer to examine the effect of the number of components. We used rectified linear unit (ReLU) as the activation function in the middle layers, and an adaptive Maxout unit exclusively for the output layer. Maxout unit was constructed by taking the maximum across two affine fullyconnected weight groups. To prevent overfitting, we applied dropout and batch normalization to hidden layers. The MLRs follow the feature extractor. Its goal is to predict segment labels from the activities of components extracted by the feature extractor. NICA(IIA) settings: In addition to MLP for feature extractor ( featur e − MLP ), we used another MLP that took the time delayed ( 𝑥 𝑡 −1∶ 𝑡 −3 ) of the parcel time series as the input, which was called 𝜙− MLP , since IIA included a recurrent structure of the observations in the model ( Morioka et al., 2021 ). Here, a third-order autoregression model was assumed based on our preliminary experiments (Fig. S7). Regarding the high temporal resolution of M/EEG signals (fs = 256), we fixed the time lag between two consecutive samples to 8 (31 ms), which means 𝑥 ( 𝑡 − 1 ) took the value by shifting 8 samples of 𝑥 (e.g., 𝑥 ( 𝑡 − 8 ) ). The architectures of the featur e − MLP and 𝜙− MLP were the same as that in NICA(TCL) except that the point-wise square nonlinearity was applied in the last layer. In IIA model, the MLRs took the inputs that were the weighted squared sums of the output units of the featur e − MLP and 𝜙− MLP , respectively (see Fig. S1 for demonstration). To perform the time-contrastive learning, we segmented the parcel time series (data size: 400 parcels ×number of time points) into equal size of 3 s (768 data points) for each subject. We first tested the effect of the segment length on the downstream task and 3-s segment length seemed to provide a relatively optimal classification accuracy in the audio-visual MEG data. (Fig. S2). The feature extractor took 400 ×1 values at single time points as one sample, and was followed MLRs that gave the segment label. Since different subjects were likely to have uninteresting technical differences in terms of the group-level training, we applied a multi-task (multi-subject) learning scheme, which included a separate top-layer MLR classifier (subject-specific) for each subject, but a shared feature extractor ( Fig. 1 B). 5
Y. Zhu, T. Parviainen, E. Heinilä et al. NeuroImage 274 (2023) 120142 Fig. 2. Illustration of the occlusion sensitivity analysis. The p-th parcel signal was set to zero and the time series were feed into well-trained feature extractor 𝐡 ( 𝒙 , 𝜽∗ ) (followed by an unmixing matrix from linear ICA if the model was NICA(TCL)) and obtained the components with occlusion. The true components were obtained by the original time series. The maps were computed according to Eq. (6) . The networks (feature extractor and the MLRs) were trained by stochastic gradient descent (SGD) based on back-propagation, which is commonly used in deep learning studies. The other training parameters were set as follows: Initial learning rate of 0.01, learning rate decay of 0.1, momentum of SGD of 0.9, and mini-batch size of 256. The initial weights of each layer were randomly drawn from a uniform distribution. The loss function is the cross entropy between the predicted and true segment label. After TCL training is finished, fastICA with the default setting in scikit-learn ( Pedregosa et al., 2011 ) is applied to the outputs of the feature extractor in the NICA(TCL) model, but not used in the NICA(IIA) model. The training was performed only from restingstate MEG data in the Cam-CAN repository; the audio-visual MEG data were later used to evaluate the generalizability of the trained network. Furthermore, the neurofeedback data were used to test the ability to transfer the nonlinear ICA models to a new dataset, as an example of the potential applications. 2.6. Visualizing the spatial, spectral and temporal profiles of representations For examining the resulting components (i.e., after linear ICA on the output of feature extractor for NICA(TCL) and output of feature extractor for NICA(IIA)), we extracted components from the dataset by applying the trained feature extractor to resting-state sessions. We then performed spectral analysis on the components across the segments to see their spectral profiles. The power spectral density (PSD) was estimated for each segment by a discrete Fourier transform, after standardizing the signal within the segment to have zero-mean and unit variance. To examine the spatial characteristics of the components, spatial profiles were obtained by examining the sensitivity of feature extractor outputs to the occlusion parcel signals. This method is commonly used in deep learning studies for computer vision to visualize the input specificities of the neural network by systematically occluding different regions of the input image with a grey square, and monitoring the output of the neural networks ( Zeiler and Fergus, 2014 ). The idea is that the probability of the correct class would drop significantly when the actual object was occluded, in an image classification task. One could visualize the heatmap of the probability of the correct label as a function of the occluded position in the image space. Different from the image classification context, however, we here attempted to examine the effect of each parcel signal on the components of the time series, and thus computed the correlation between the ‘true’ components (outputs without occlusion) and the components with occlusion, instead of the classification probability with occlusion. Specifically, for each component, we obtained the cortical heatmap of the correlation as a function of the parcel position. The correlation with the ‘true’ components would drop significantly when the occluded parcel was important for the disentanglement of the corresponding component. Intuitively, the cortical heatmaps of the contribution were calculated as: 𝑐 𝑖 ( 𝑝 ) = 1 − |||𝑐𝑜𝑟𝑟 (𝒔 𝑖 , 𝒔 𝑝 𝑖 )|||(6) where 𝒔 𝑖 is the 𝑖 -th component without occlusion, and 𝒔 𝑝 𝑖 is the occluded component by occluding the 𝑝 -th parcel input (set to zero). 𝑐𝑜𝑟𝑟 () indicates the Pearson correlation, and |() |is the absolute value ( Fig. 2 ). 𝒄 𝑖 presents the spatial pattern of 𝑖 -th component, which might be considered as a nonlinear version of co-activation patterns for linear ICA. We also visualized the segment-wise band-limited power (variances) to see the temporal non-stationarities. 2.7. Downstream task of classification from audio-visual MEG We used the trained model for classification of the stimulus modality in the audio-visual task MEG data to evaluate the performance of the generalizability to the downstream task. Specifically, the audio-visual MEG data were cropped into epochs from − 300 ms to 500 ms after each stimulus onset. After source reconstruction, the parcel time series were fed into the feature extractor to obtain the components ( Fig. 1 C). Thereafter, the classification was performed using a linear support vector machine (SVM) classifier as implemented in scikit-learn ( Pedregosa et al., 2011 ), which was trained on the stimulus labels and sliding-window- averaged components (width = 20 and stride = 8 samples) obtained for each epoch. Note that the features input to the classifier are obtained by sliding-window-averaged components. We here perform epoch-wise decoding (not sample-wise decoding), which is not sensitive to the length of the pre-stimulus period and can significantly improve the accuracy of the classification for event-related data ( Schirrmeister et al., 2017 ). The performance was evaluated by the generalizability of a classifier across subjects, i.e., one-subject-out cross-validation (OSO–CV). 2.8. Comparison with fully supervised and other self-supervised learning Nonlinear ICA models were compared to baseline approaches on the downstream tasks including other self-supervised learning (SSL) and purely supervised learning methods. For the baseline SSL, we adopted the temporal context prediction tasks Relative Positioning (RP) for feature learning in the pretext task ( Banville et al., 2021 ), which is closely related to nonlinear ICA. We adopted StagerNet, a four-layer convolutional neural network, as the feature extractor (embedder) in SSL 6
Y. Zhu, T. Parviainen, E. Heinilä et al. NeuroImage 274 (2023) 120142 ( Banville et al., 2021 ). For the purely supervised learning, we used the EEGNet as the deep learning architecture ( Lawhern et al., 2018 ), as it has shown to perform well for epoch-wise classification across participants. SSL(RP) was trained on resting-state data like nonlinear ICA. For the main hyperparameters of SSL(RP), window length, 𝜏𝑝𝑜𝑠 and 𝜏𝑛𝑒𝑔 (controlling the size of the “positive ”and “negative ”contexts, respectively), we first tested the performance of the downstream task by setting different parameter values and chose the values with close-to-optimal classification accuracies based on the instructions in the original paper with plain cross-validation. We finally set window length to 2 s, 𝜏𝑝𝑜𝑠 = 5 s and 𝜏𝑛𝑒𝑔 = 120 s. The purely supervised case was directly trained on the audio-visual task data, i.e., it had access to the labeled data. 2.9. Generalization to mental-states dataset We validated the generalization or transfer of the nonlinear ICA components using neurofeedback data as an independent dataset ( Zhigalov et al., 2019 ), where we attempted to decode attentional states (mindfulness or wandering thoughts) from ongoing brain activity measured by MEG. Similar to the downstream task on audio-visual data, we extracted the nonlinear components by applying the feature extractor trained on resting-state data from Cam-CAN repository on neurofeedback signals ( Fig. 1 C). For classification, we performed epoch-wise decoding, which means the averaged squared activities of components during each non-overlapping 2 s epoch were used as feature vectors for the linear SVM classifier. We further used linear feature extraction methods (linear ICA and PCA) and fully supervised deep learning for comparison. The FastICA and PCA methods were adopted as the traditional linear baseline feature extractor, and 15 components were also extracted for a fair comparison of the nonlinear ICA. The linear components were divided into 4-s epochs with 75% overlap and the epochs were Fouriertransformed and the spectra divided into four frequency bands: delta (1–3 Hz), theta (4–7 Hz), alpha (8–12 Hz), and low-beta (13–24 Hz). The amplitude spectra averaged (across frequencies) inside these four frequency bands were then used as features for classification, which is a baseline method provided by our prior study ( Zhigalov et al., 2019 ). For the fully supervised method, we adopted the StagerNet as the supervised deep learning architecture, which was shown to suit well for windowwise classification of ongoing data in sleep staging ( Banville et al., 2021 ; Chambon et al., 2018 ). Different from the 30 s window-wise decoding in sleep staging, we here set a 4-s window as one sample since we had a relatively short data duration. 2.9.1. Classification methods: individual vs. group classification We used two scenarios to train and test the SVM classifiers. In the first scenario of “individual classifier ”, we trained the classifier using individual data from the first session and tested the classifier using data from the second session. In the second scenario of “group classifier ”, we trained the classifier using data from both sessions and all subjects except one “testing ”subject and tested the classifier using the testing subject’s data from the second session. The second scenario is more challenging, essentially providing information on the generalizability of the classifier across subjects. We applied the features extracted from all methods to investigate whether and how it is possible to discriminate (decode) between mindfulness meditation (MF), future planning (FP), and reflection on anxious-inducing emotional pictures (EP) tasks. 2.9.2. Statistical analysis of classification accuracies between methods To assess the statistical differences between the classification accuracies for different tasks or for different decoding methods, we applied the Wilcoxon signed-rank test with FDR correction. Specifically, for each subject, we have one classification accuracy value for each method since we use leave one out cross-validation for the SVM classifiers. All the subjects’ accuracies were fed into the Wilcoxon rank sum test. 3. Results 3.1. Nonlinear ICA learns representations that show spectra-specific brain patterns The feature extractors learned component-specific, spatiotemporal elements, so as to disentangle the MEG data into latent nonlinear components. The learning was based on logistic regression in a “selfsupervised ”scheme where class labels of time series fragments were defined based on temporal segments. To understand what kind of representation was captured from data by NICA(IIA), we visualized the spatiotemporal and spectral patterns for each component ( Fig. 3 ). The spatial patterns were computed by occlusion sensitivity analysis ( Fig. 3 A), which quantified the contribution to the disentanglement of the corresponding component. The obtained spatial patterns could be considered as co-activation patterns in the nonlinear case. We also computed representative frequency spectra by taking the average of the spectra of the segment-wise components ( Fig. 3 B). The temporal profiles were obtained by taking the segment-wise band-limited power (variances), exposing the temporal non-stationarities ( Fig. 3 C). Here, we just show 5 of the 15 components for simplicity; the others are shown in the supplementary material (Fig. S3) and the components extracted by linear ICA are also shown in the supplementary material (Fig. S9) for comparison. These representative patterns, learned from resting-state data, seem to exhibit frequency-specific co-activation patterns similar to previously reported brain networks ( Brookes et al., 2011 ; Vidaurre et al., 2018 ). Components I, II and IV had similar spectral modes that peaks in around 25 Hz. The brain activities of I and II have similar but distinct spatial distributions, especially around primary somatosensory and motor cortices, which represented the beta-specific motor networks reported earlier ( O’Neill et al., 2017 ; Ramkumar et al., 2014 ). Component IV shows a distribution spanning frontal, parietal and right temporal cortices exhibiting a beta-dominated spectrum, which may be related to the beta-dependent fronto-parietal networks ( Brookes et al., 2011 ). Components III and V have a spectrum peaking at approximately 10 Hz. Component III exhibits local maxima in the primary and secondary frontal areas, and posterior parietal cortices, similar to IV but different spectral mode. Component V shows a strong visual-cortex pattern with an alpha-dominated spectral features. Additionally, the temporal profiles of the components demonstrate fluctuations in time ( Fig 3 C), which is consistent with the non-stationarity assumption of the time-contrastive learning. 3.2. Nonlinear ICA facilitates downstream task with limited labeled data To examine whether nonlinear ICA trained on resting-state session data reduces the need for labeled task-session MEG data, we applied the trained feature extractors to audio-visual task MEG data. We compared their performance on this downstream task to one of the various established approaches such as fully supervised learning, while varying the number of labeled samples available. Downstream task performance was evaluated by training linear SVM models on labeled samples, where the training set contained at least one and up to all existing labeled examples. Additionally, fully supervised models were trained directly on labeled data only. We also included traditional linear methods, linear ICA and Principal Component Analysis (PCA), as feature extractors for comparison. The same number of components as nonlinear ICA was set and the linear unmixing and loading matrix were trained on unlabeled resting-state data. One can see that the linear ICA and PCA as feature extractors underperformed the deep-learning methods. Fig. 4 A demonstrates the impact of the number of labeled data on downstream performance. First, when using well-trained feature extractor in nonlinear ICA for the downstream tasks, we observed important above-chance performance, 88.3% and 85.5% test accuracy (2-class, chance level = 50%) for NICA(IIA) and NICA(TCL), separately. Additionally, we observed that the performance of nonlinear ICA outperformed alternative approaches 7
Y. Zhu, T. Parviainen, E. Heinilä et al. NeuroImage 274 (2023) 120142 Fig. 3. Representations learned by nonlinear ICA, which seem to represent frequency-specific spatial patterns. Here, we show five components (the remaining components are given in the supplementary material Fig. S3). A: Spatial patterns similar to the RSNs obtained by fMRI or MEG. Such spatial profiles were obtained by examining the contribution of each parcel to the components (see Section 2.6 ). B: Averaged segment-wise spectra of the components. C: Segment-wise band-limited power (or variances), showing the temporal non-stationarity, (we just show 500 s length for demonstration). Fig. 4. Downstream tasks on visual-auditory session data with limited labels. A. Impact of the number of labeled samples per class on downstream performance and comparison with a self-supervised paradigm based on relative positioning task (SSL-RP) and a full supervised deep model as well as linear ICA and PCA. B. The effects of component numbers in NICA(IIA). C-D. The spatial and temporal profiles of the top components contributing the classification. The temporal profiles of the components averaged separately for auditory (orange) and visual trials (blue). 0 s is the onset of the stimulus. (For interpretation of the references to color in this figure legend, the reader is referred to the web version of this article.) including the fully supervised model in low-labeled data regimes. The performance gap between nonlinear ICA and full supervision was as high as 16.8 percentage points when the number of labeled examples was less than 100. It remained in favor of nonlinear ICA models up to around 1000 examples per class, at which point full supervision finally began to exceed the performance of nonlinear ICA. These results show that nonlinear ICA with training on unlabeled data was general-purpose enough to facilitate classification problems based on stimuli-induced data; it systematically outperformed or equaled other methods in low-to-medium labeled data regimes and remained competitive in a high labeled data regime. Note that all the analysis that follows is based on NICA(IIA), since it outperformed NICA(TCL) here. As with many other ICA algorithms, it was also challenging for nonlinear ICA to determine the number of components, and choosing different number of components might affect the results to some extent. We here examined the impact of different numbers of extracted components in NICA(IIA) on the downstream classification task. As can be seen in Fig. 4 B, the performance starts to reach the optimal level when the 8