pyriemann.estimation.BlockCovariances

class pyriemann.estimation.BlockCovariances(block_size, estimator='scm', **kwds)

Estimation of block covariance matrices.

Perform a block covariance estimation for each given matrix. The resulting matrices are block diagonal matrices.

The blocks on the diagonal are calculated as individual covariance matrices for a subset of channels using the given the estimator. Varying block sized possible by passing a list to allow incorporation of different modalities with different number of channels (e.g. EEG, ECoG, LFP, EMG) with their own respective covariance matrices.

Parameters:
block_sizeint | list of int

Sizes of individual blocks given as int for same-size block, or list for varying block sizes.

estimatorstring, default=’scm’

Covariance matrix estimator, see pyriemann.utils.covariance.covariances().

**kwdsdict

Any further parameters are passed directly to the covariance estimator.

See also

Covariances

Notes

New in version 0.3.

__init__(block_size, estimator='scm', **kwds)

Init.

fit(X, y=None)

Fit.

Do nothing. For compatibility purpose.

Parameters:
Xndarray, shape (n_matrices, n_channels, n_times)

Multi-channel time-series.

yNone

Not used, here for compatibility with sklearn API.

Returns:
selfBlockCovariances instance

The BlockCovariances instance.

fit_transform(X, y=None, **fit_params)

Fit to data, then transform it.

Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.

Parameters:
Xarray-like of shape (n_samples, n_features)

Input samples.

yarray-like of shape (n_samples,) or (n_samples, n_outputs), default=None

Target values (None for unsupervised transformations).

**fit_paramsdict

Additional fit parameters.

Returns:
X_newndarray array of shape (n_samples, n_features_new)

Transformed array.

get_metadata_routing()

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)

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_output(*, transform=None)

Set output container.

See sphx_glr_auto_examples_miscellaneous_plot_set_output.py for an example on how to use the API.

Parameters:
transform{“default”, “pandas”}, default=None

Configure output of transform and fit_transform.

  • “default”: Default output format of a transformer

  • “pandas”: DataFrame output

  • None: Transform configuration is unchanged

Returns:
selfestimator instance

Estimator instance.

set_params(**params)

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.

transform(X)

Estimate block covariance matrices.

Parameters:
Xndarray, shape (n_matrices, n_channels, n_times)

Multi-channel time-series.

Returns:
covmatsndarray, shape (n_matrices, n_channels, n_channels)

Covariance matrices.