mne.decoding.SSD#
- class mne.decoding.SSD(info, filt_params_signal, filt_params_noise, reg=None, n_components=None, picks=None, sort_by_spectral_ratio=True, return_filtered=False, n_fft=None, cov_method_params=None, rank=None)[source]#
Signal decomposition using the Spatio-Spectral Decomposition (SSD).
SSD seeks to maximize the power at a frequency band of interest while simultaneously minimizing it at the flanking (surrounding) frequency bins (considered noise). It extremizes the covariance matrices associated with signal and noise [1].
SSD can either be used as a dimensionality reduction method or a ‘denoised’ low rank factorization method [2].
- Parameters:
- info
mne.Info
The
mne.Info
object with information about the sensors and methods of measurement. Must match the input data.- filt_params_signal
dict
Filtering for the frequencies of interest.
- filt_params_noise
dict
Filtering for the frequencies of non-interest.
- reg
float
|str
|None
(default) Which covariance estimator to use. If not None (same as ‘empirical’), allow regularization for covariance estimation. If float, shrinkage is used (0 <= shrinkage <= 1). For str options, reg will be passed to method
mne.compute_covariance()
.- n_components
int
|None
(defaultNone
) The number of components to extract from the signal. If None, the number of components equal to the rank of the data are returned (see
rank
).- picks
array
ofint
|None
(defaultNone
) The indices of good channels.
- sort_by_spectral_ratiobool (default
True
) If set to True, the components are sorted according to the spectral ratio. See Eq. (24) in [1].
- return_filteredbool (default
False
) If return_filtered is True, data is bandpassed and projected onto the SSD components.
- n_fft
int
(defaultNone
) If sort_by_spectral_ratio is set to True, then the SSD sources will be sorted according to their spectral ratio which is calculated based on
mne.time_frequency.psd_array_welch()
. The n_fft parameter sets the length of FFT used. Seemne.time_frequency.psd_array_welch()
for more information.- cov_method_params
dict
|None
(defaultNone
) As in
mne.decoding.SPoC
The default is None.- rank
None
|dict
| ‘info’ | ‘full’ As in
mne.decoding.SPoC
This controls the rank computation that can be read from the measurement info or estimated from the data, which determines the maximum possible number of components. See Notes ofmne.compute_rank()
for details. We recommend to use ‘full’ when working with epoched data.
- info
References
- Attributes:
Methods
apply
(X)Remove selected components from the signal.
fit
(X[, y])Estimate the SSD decomposition on raw or epoched data.
fit_transform
(X[, y])Fit to data, then transform it.
get_params
([deep])Get parameters for this estimator.
get_spectral_ratio
(ssd_sources)Get the spectal signal-to-noise ratio for each spatial filter.
Not implemented yet.
set_params
(**params)Set the parameters of this estimator.
transform
(X)Estimate epochs sources given the SSD filters.
- apply(X)[source]#
Remove selected components from the signal.
This procedure will reconstruct M/EEG signals from which the dynamics described by the excluded components is subtracted (denoised by low-rank factorization). See [2] for more information.
Note
Unlike in other classes with an apply method, only NumPy arrays are supported (not instances of MNE objects).
- Parameters:
- Xarray, shape ([n_epochs, ]n_channels, n_times)
The input data from which to estimate the SSD. Either 2D array obtained from continuous data or 3D array obtained from epoched data.
- Returns:
- Xarray, shape ([n_epochs, ]n_channels, n_times)
The processed data.
- fit(X, y=None)[source]#
Estimate the SSD decomposition on raw or epoched data.
- Parameters:
- Returns:
- selfinstance of
SSD
Returns the modified instance.
- selfinstance of
Examples using
fit
:Compute Spectro-Spatial Decomposition (SSD) spatial filters
Compute Spectro-Spatial Decomposition (SSD) spatial filters
- fit_transform(X, y=None, **fit_params)[source]#
Fit to data, then transform it.
Fits transformer to
X
andy
with optional parametersfit_params
, and returns a transformed version ofX
.
- get_spectral_ratio(ssd_sources)[source]#
Get the spectal signal-to-noise ratio for each spatial filter.
Spectral ratio measure for best n_components selection See [1], Eq. (24).
- Parameters:
- ssd_sources
array
Data projected to SSD space.
- ssd_sources
- Returns:
References
Examples using
get_spectral_ratio
:Compute Spectro-Spatial Decomposition (SSD) spatial filters
Compute Spectro-Spatial Decomposition (SSD) spatial filters
- set_params(**params)[source]#
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]#
Estimate epochs sources given the SSD filters.
- Parameters:
- Xarray, shape ([n_epochs, ]n_channels, n_times)
The input data from which to estimate the SSD. Either 2D array obtained from continuous data or 3D array obtained from epoched data.
- Returns:
- X_ssdarray, shape ([n_epochs, ]n_components, n_times)
The processed data.
Examples using
transform
:Compute Spectro-Spatial Decomposition (SSD) spatial filters
Compute Spectro-Spatial Decomposition (SSD) spatial filters
Examples using mne.decoding.SSD
#
Compute Spectro-Spatial Decomposition (SSD) spatial filters