MCPcopy
hub / github.com/mne-tools/mne-python / LinearModel

Class LinearModel

mne/decoding/base.py:416–572  ·  view source on GitHub ↗

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 :footcite:`HaufeEtAl2

Source from the content-addressed store, hash-verified

414
415
416class LinearModel(MetaEstimatorMixin, BaseEstimator):
417 """Compute and store patterns from linear models.
418
419 The linear model coefficients (filters) are used to extract discriminant
420 neural sources from the measured data. This class computes the
421 corresponding patterns of these linear filters to make them more
422 interpretable :footcite:`HaufeEtAl2014`.
423
424 Parameters
425 ----------
426 model : object | None
427 A linear model from scikit-learn with a fit method
428 that updates a ``coef_`` attribute.
429 If None the model will be
430 :class:`sklearn.linear_model.LogisticRegression`.
431
432 Attributes
433 ----------
434 filters_ : ndarray, shape ([n_targets], n_features)
435 If fit, the filters used to decompose the data.
436 patterns_ : ndarray, shape ([n_targets], n_features)
437 If fit, the patterns used to restore M/EEG signals.
438
439 See Also
440 --------
441 CSP
442 mne.preprocessing.ICA
443 mne.preprocessing.Xdawn
444
445 Notes
446 -----
447 .. versionadded:: 0.10
448
449 References
450 ----------
451 .. footbibliography::
452 """
453
454 _model_attr_wrap = (
455 "transform",
456 "fit_transform",
457 "predict",
458 "predict_proba",
459 "predict_log_proba",
460 "_estimator_type", # remove after sklearn 1.6
461 "decision_function",
462 "score",
463 "classes_",
464 )
465
466 def __init__(self, model=None):
467 self.model = model
468
469 def __sklearn_tags__(self):
470 """Get sklearn tags."""
471 tags = super().__sklearn_tags__()
472 model = self.model if self.model is not None else LogisticRegression()
473 model_tags = model.__sklearn_tags__()

Callers 11

test_vectorizerFunction · 0.90
test_regularized_cspFunction · 0.90
test_get_coefFunction · 0.90
test_get_coef_multiclassFunction · 0.90
test_linearmodelFunction · 0.90
test_spatial_filter_initFunction · 0.90
50_decoding.pyFile · 0.90

Calls

no outgoing calls

Tested by 8

test_vectorizerFunction · 0.72
test_regularized_cspFunction · 0.72
test_get_coefFunction · 0.72
test_get_coef_multiclassFunction · 0.72
test_linearmodelFunction · 0.72
test_spatial_filter_initFunction · 0.72