mne.decoding.get_spatial_filter_from_estimator#

mne.decoding.get_spatial_filter_from_estimator(estimator, info, *, inverse_transform=False, step_name=None, get_coefs=('filters_', 'patterns_', 'evals_'), patterns_method=None, verbose=None)[source]#

Instantiate a mne.decoding.SpatialFilter object.

Creates object from the fitted generalized eigendecomposition transformers or mne.decoding.LinearModel. This object can be used to visualize spatial filters, patterns, and eigenvalues.

Parameters:
estimatorinstance of sklearn.base.BaseEstimator

Sklearn-based estimator or meta-estimator from which to initialize spatial filter. Use step_name to select relevant transformer from the pipeline object (works with nested names using __ syntax).

infoinstance of mne.Info

The measurement info object for plotting topomaps.

inverse_transformbool

If True, returns filters and patterns after inverse transforming them with the transformer steps of the estimator. Defaults to False.

step_namestr | None

Name of the sklearn’s pipeline step to get the coefs from. If inverse_transform is True, the inverse transformations will be applied using transformers before this step. If None, the last step will be used. Defaults to None.

get_coefstuple

The names of the coefficient attributes to retrieve, can include 'filters_', 'patterns_' and 'evals_'. If step is GEDTransformer, will use all. if step is LinearModel will only use 'filters_' and 'patterns_'. Defaults to ('filters_', 'patterns_', 'evals_').

patterns_methodstr

The method used to compute the patterns. Can be None, 'pinv' or 'haufe'. It will be set automatically to 'pinv' if step is GEDTransformer, or to 'haufe' if step is LinearModel. Defaults to None.

verbosebool | str | int | None

Control verbosity of the logging output. If None, use the default verbosity level. See the logging documentation and mne.verbose() for details. Should only be passed as a keyword argument.

Returns:
sp_filterinstance of mne.decoding.SpatialFilter

The spatial filter object.

Notes

New in v1.11.

Examples using mne.decoding.get_spatial_filter_from_estimator#

Motor imagery decoding from EEG data using the Common Spatial Pattern (CSP)

Motor imagery decoding from EEG data using the Common Spatial Pattern (CSP)

Continuous Target Decoding with SPoC

Continuous Target Decoding with SPoC

XDAWN Decoding From EEG data

XDAWN Decoding From EEG data

Linear classifier on sensor data with plot patterns and filters

Linear classifier on sensor data with plot patterns and filters

Compute spatial filters with Spatio-Spectral Decomposition (SSD)

Compute spatial filters with Spatio-Spectral Decomposition (SSD)

Decoding (MVPA)

Decoding (MVPA)