Skip to content

igl.preprocessing

Sklearn-compatible preprocessing transformers for EEG / SPD-valued data. Subpackage gated behind the [eeg] extra (which ships pyriemann); plain installs will raise IGLDependencyError on import.

pip install intrinsic-green-learning[eeg]

Auto covariances

igl.preprocessing.covariances.AutoCovariances

Bases: BaseEstimator, TransformerMixin

Choose Ledoit-Wolf or sample covariance automatically.

Heuristic derived empirically on MOABB motor-imagery datasets at 128 Hz (see alex-eeg-igl ยง6.5): per-trial sample covariance is statistically rank-marginal when the trial has fewer than ~500 time samples, so LWF shrinkage helps; above that threshold sample covariance is well- estimated and unshrunk covariance preserves discriminative spectrum structure that LWF would flatten.

Decision is made once at :meth:fit time based on the training batch's last dimension, and applied consistently to every subsequent :meth:transform call. Mixing trial lengths within a pipeline is unsupported (standard sklearn convention).

Parameters:

Name Type Description Default
T_threshold int

Trial length below which LWF is selected. The empirical 500 default was tuned at 128 Hz on EEG motor imagery; modalities at other sampling rates may need to override. See the memo's "Out of scope" section.

_DEFAULT_T_THRESHOLD
force CovarianceEstimatorLike

Override the heuristic. "auto" (default) applies the heuristic; "lwf" / "cov" act as plain :class:pyriemann.estimation.Covariances passthrough.

AUTO

Attributes:

Name Type Description
estimator_

The pyriemann estimator name ("lwf" or "cov") actually selected at fit time.

fit(x, y=None)

Pick the estimator from x.shape[-1] and fit the inner Covariances.

transform(x)

Compute the SPD batch from raw signals via the fitted estimator.

igl.preprocessing.covariances.CovarianceEstimator

Bases: StrEnum

Pyriemann estimator identifier accepted by :class:AutoCovariances.