mne.decoding.LinearModel#

class mne.decoding.LinearModel(model=None)[source]#

Compute and store patterns from linear models.

The linear model coefficients (filters) are used to extract discriminant neural sources from the measured data. This class computes the corresponding patterns of these linear filters to make them more interpretable [1].

Parameters:
modelobject | None

A linear model from scikit-learn with a fit method that updates a coef_ attribute. If None the model will be LogisticRegression.

Attributes:
filters_ndarray, shape ([n_targets], n_features)

If fit, the filters used to decompose the data.

patterns_ndarray, shape ([n_targets], n_features)

If fit, the patterns used to restore M/EEG signals.

Methods

fit(X, y, **fit_params)

Estimate the coefficients of the linear model.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

set_params(**params)

Set the parameters of this estimator.

Notes

New in v0.10.

References

fit(X, y, **fit_params)[source]#

Estimate the coefficients of the linear model.

Save the coefficients in the attribute filters_ and computes the attribute patterns_.

Parameters:
Xarray, shape (n_samples, n_features)

The training input samples to estimate the linear coefficients.

yarray, shape (n_samples, [n_targets])

The target values.

**fit_paramsdict of str -> object

Parameters to pass to the fit method of the estimator.

Returns:
selfinstance of LinearModel

Returns the modified instance.

Examples using fit:

Linear classifier on sensor data with plot patterns and filters

Linear classifier on sensor data with plot patterns and filters
get_metadata_routing()[source]#

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Returns:
routingMetadataRequest

A MetadataRequest encapsulating routing information.

get_params(deep=True)[source]#

Get parameters for this estimator.

Parameters:
deepbool, default=True

If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:
paramsdict

Parameter names mapped to their values.

set_params(**params)[source]#

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Parameters:
**paramsdict

Estimator parameters.

Returns:
selfestimator instance

Estimator instance.

Examples using mne.decoding.LinearModel#

Decoding (MVPA)

Decoding (MVPA)

Decoding source space data

Decoding source space data

Linear classifier on sensor data with plot patterns and filters

Linear classifier on sensor data with plot patterns and filters