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 [R38].
Parameters:  model : object  None


See also
Notes
New in version 0.10.
References
[R38]  (1, 2) Haufe, S., Meinecke, F., Gorgen, K., Dahne, S., Haynes, J.D., Blankertz, B., & Biebmann, F. (2014). On the interpretation of weight vectors of linear models in multivariate neuroimaging. NeuroImage, 87, 96110. 
Attributes
filters_ 
(ndarray) If fit, the filters used to decompose the data. 
patterns_ 
(ndarray) If fit, the patterns used to restore M/EEG signals. 
Methods
__hash__ () <==> hash(x) 

fit (X, y) 
Estimate the coefficients of the linear model. 
fit_transform (X, y) 
Fit the data and transform it using the linear model. 
get_params ([deep]) 
Get parameters for this estimator. 
plot_filters (*args, **kwargs) 
Warning DEPRECATED: plot_filters is deprecated and will be removed in 0.15, use EvokedArray instead. 
plot_patterns (*args, **kwargs) 
Warning DEPRECATED: plot_filters is deprecated and will be removed in 0.15, use EvokedArray instead. 
predict (X) 
Compute predictions of y from X. 
score (X, y) 
Score the linear model computed on the given test data. 
set_params (**params) 
Set the parameters of this estimator. 
transform (X) 
Transform the data using the linear model. 
__hash__
() <==> hash(x)¶fit
(X, y)[source]¶Estimate the coefficients of the linear model.
Save the coefficients in the attribute filters_
and
computes the attribute patterns_
.
Parameters:  X : array, shape (n_samples, n_features)
y : array, shape (n_samples,)


Returns:  self : instance of LinearModel

fit_transform
(X, y)[source]¶Fit the data and transform it using the linear model.
Parameters:  X : array, shape (n_samples, n_features)
y : array, shape (n_samples,)


Returns:  y_pred : array, shape (n_samples,)

get_params
(deep=True)[source]¶Get parameters for this estimator.
Parameters:  deep : boolean, optional


Returns:  params : mapping of string to any

plot_filters
(*args, **kwargs)[source]¶Warning
DEPRECATED: plot_filters is deprecated and will be removed in 0.15, use EvokedArray instead.
Plot topographic filters of the linear model.
The filters are used to extract discriminant neural sources from the measured data (a.k.a. the backward model).
Parameters:  info : instance of Info


Returns:  fig : instance of matplotlib.figure.Figure

plot_patterns
(*args, **kwargs)[source]¶Warning
DEPRECATED: plot_filters is deprecated and will be removed in 0.15, use EvokedArray instead.
Plot topographic patterns of the linear model.
The patterns explain how the measured data was generated from the neural sources (a.k.a. the forward model).
Parameters:  info : instance of Info


Returns:  fig : instance of matplotlib.figure.Figure

predict
(X)[source]¶Compute predictions of y from X.
Parameters:  X : array, shape (n_samples, n_features)


Returns:  y_pred : array, shape (n_samples,)

score
(X, y)[source]¶Score the linear model computed on the given test data.
Parameters:  X : array, shape (n_samples, n_features)
y : array, shape (n_samples,)


Returns:  score : float

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.
Returns
——
self