mne_connectivity.decoding.CoherencyDecomposition#
- class mne_connectivity.decoding.CoherencyDecomposition(info, method, indices, mode='multitaper', fmin=None, fmax=None, mt_bandwidth=None, mt_adaptive=False, mt_low_bias=True, cwt_freqs=None, cwt_n_cycles=7, n_components=None, rank=None, n_jobs=1, verbose=None)[source]#
Decompose connectivity sources using multivariate coherency-based methods.
- Parameters:
- info
mne.Info
Information about the data which will be decomposed and transformed, such as that coming from an
mne.Epochs
object. The number of channels must match the subsequent input data.- method
str
The multivariate method to use for the decomposition. Can be:
- indices
tuple
ofarray
A tuple of two arrays, containing the indices of the seed and target channels in the input data, respectively. The indices of only a single connection (i.e. between one group of seeds and one group of targets) is supported.
- mode
str
(default “multitaper”) The cross-spectral density computation method. Can be
"multitaper"
,"fourier"
, or"cwt_morlet"
.- fmin
int
|float
|None
(defaultNone
) The lowest frequency of interest in Hz. Must not be
None
and only used ifmode in ["multitaper", "fourier"]
.- fmax
int
|float
|None
(defaultNone
) The highest frequency of interest in Hz. Must not be
None
and only used ifmode in ["multitaper", "fourier"]
.- mt_bandwidth
int
|float
|None
(defaultNone
) The bandwidth of the multitaper windowing function in Hz to use when computing the cross-spectral density. Only used if
mode="multitaper"
.- mt_adaptivebool (default
False
) Whether to use adaptive weights when combining the tapered spectra in the cross-spectral density. Only used if
mode="multitaper"
.- mt_low_biasbool (default
True
) Whether to use tapers with over 90 percent spectral concentration within the bandwidth when computing the cross-spectral density. Only used if
mode="multitaper"
.- cwt_freqs
array
ofint
orfloat
|None
(defaultNone
) The frequencies of interest in Hz. Must not be
None
and only used ifmode="cwt_morlet"
.- cwt_n_cycles
int
|float
|array
ofint
orfloat
(default 7) The number of cycles to use when constructing the Morlet wavelets. Fixed number or one per frequency. Only used if
mode=cwt_morlet
.- n_components
int
|None
(defaultNone
) The number of connectivity components (sources) to extract from the data. If
None
, the number of components equal to the minimum rank of the seeds and targets is extracted (see therank
parameter). If anint
, the number of components must be <= the minimum rank of the seeds and targets. E.g. if the seed channels had a rank of 5 and the target channels had a rank of 3,n_components
must be <= 3.- rank
tuple
ofint
|None
(defaultNone
) A tuple of two ints, containing the degree of rank subspace projection to apply to the seed and target data, respectively, before filters are fit. If
None
, the rank of the seed and target data is used. If a tuple of ints, the entries must be <= the rank of the seed and target data. The minimum rank of the seeds and targets determines the maximum number of connectivity components (sources) which can be extracted from the data (see then_components
parameter). Specifying ranks below that of the data may reduce the degree of overfitting when computing the filters.- n_jobs
int
The number of jobs to run in parallel (default 1). Requires the joblib package.
- verbosebool,
str
,int
, orNone
If not None, override default verbose level (see
mne.verbose()
for more info). If used, it should be passed as a keyword-argument only.
- info
Notes
The multivariate methods maximise connectivity between a set of seed and target signals in a frequency-resolved manner. The maximisation of connectivity involves fitting spatial filters to the cross-spectral density of the seed and target data, alongside which spatial patterns of the contributions to connectivity can be computed [3].
Once fit, the filters can be used to transform data into the underlying connectivity components. Connectivity can be computed on this transformed data using the bivariate coherency-based methods of the
mne_connectivity.spectral_connectivity_epochs
andmne_connectivity.spectral_connectivity_time
functions. These bivariate methods are:The approach taken here is to optimise the connectivity in a given frequency band. Frequency bin-wise optimisation is offered in the multivariate coherency-based methods of the
mne_connectivity.spectral_connectivity_epochs
andmne_connectivity.spectral_connectivity_time
functions.References
- Attributes:
- filters_
tuple
ofarray
, shape=(n_signals, n_components) A tuple of two arrays containing the spatial filters for transforming the seed and target data, respectively.
- patterns_
tuple
ofarray
, shape=(n_components, n_signals) A tuple of two arrays containing the spatial patterns corresponding to the spatial filters for the seed and target data, respectively.
- filters_
Methods
fit
(X[, y])Compute connectivity decomposition filters for epoched data.
fit_transform
(X[, y])Fit filters to data, then transform and return it.
get_params
([deep])Get parameters for this estimator.
Get indices for the transformed data.
set_params
(**params)Set the parameters of this estimator.
transform
(X)Decompose data into connectivity sources using the fitted filters.
- fit(X, y=None)[source]#
Compute connectivity decomposition filters for epoched data.
- Parameters:
- Returns:
- selfinstance of
CoherencyDecomposition
The modified class instance.
- selfinstance of
- fit_transform(X, y=None, **fit_params)[source]#
Fit filters to data, then transform and return it.
- Parameters:
- X
array
, shape=(n_epochs, n_signals, n_times) The input data which the connectivity decomposition filters should be fit to and subsequently transformed.
- y
None
Ignored; exists for compatibility with scikit-learn pipelines.
- **fit_params
dict
Additional fitting parameters passed to the
fit
method. Not used for this class.
- X
- Returns:
- X_transformed
array
, shape=(n_epochs, n_components*2, n_times) The transformed data. The first
n_components
channels are the transformed seeds, and the lastn_components
channels are the transformed targets.
- X_transformed
- get_params(deep=True)#
Get parameters for this estimator.
- get_transformed_indices()[source]#
Get indices for the transformed data.
- Returns:
- indices_transformed
tuple
ofarray
Indices of seeds and targets in the transformed data with the form (seeds, targets) to be used when passing the data to
spectral_connectivity_epochs
andspectral_connectivity_time
. Entries of the indices are arranged such that connectivity would be computed between the first seed component and first target component, second seed component and second target component, etc…
- indices_transformed
- set_params(**params)#
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form
<component>__<parameter>
so that it’s possible to update each component of a nested object.- Parameters:
- **params
dict
Parameters.
- **params
- Returns:
- instinstance
The object.
- transform(X)[source]#
Decompose data into connectivity sources using the fitted filters.
- Parameters:
- X
array
, shape=((n_epochs, ) n_signals, n_times) The data to be transformed by the connectivity decomposition filters.
- X
- Returns:
- X_transformed
array
, shape=((n_epochs, ) n_components*2, n_times) The transformed data. The first
n_components
channels are the transformed seeds, and the lastn_components
channels are the transformed targets.
- X_transformed
Examples using mne_connectivity.decoding.CoherencyDecomposition
#
![](../_images/sphx_glr_cohy_decomposition_thumb.png)
Multivariate decomposition for efficient connectivity analysis