pyriemann.estimation.ERPCovariances¶
- class pyriemann.estimation.ERPCovariances(classes=None, estimator='scm', svd=None, **kwds)¶
Estimate special form covariance matrices for ERP.
Estimation of special form covariance matrix dedicated to event-related potentials (ERP) processing. For each class, a prototyped response is obtained by average across trials:
\[\mathbf{P} = \frac{1}{m} \sum_{i=1}^{m} \mathbf{X}_i\]and a super trial is built using the concatenation of \(\mathbf{P}\) and the trial \(\mathbf{X}_i\):
\[\begin{split}\mathbf{\tilde{X}}_i = \left[ \begin{array}{c} \mathbf{P} \\ \mathbf{X}_i \end{array} \right]\end{split}\]This super trial \(\mathbf{\tilde{X}}_i\) will be used for covariance estimation. This allows to take into account the spatial structure of the signal, as described in [1].
- Parameters:
- classeslist of int | None, default=None
List of classes to take into account for prototype estimation. If None, all classes will be accounted.
- estimatorstring, default=”scm”
Covariance matrix estimator, see
pyriemann.utils.covariance.covariances()
.- svdint | None, default=None
If not None, number of components of SVD used to reduce prototype responses.
- **kwdsdict
Any further parameters are passed directly to the covariance estimator.
- Attributes:
- P_ndarray, shape (n_components, n_times)
If fit, prototyped responses for each class, where n_components is equal to n_classes x n_channels if svd is None, and to n_classes x min(svd, n_channels) otherwise.
See also
References
[1]A Plug and Play P300 BCI Using Information Geometry A. Barachant, M. Congedo. Research report, 2014.
[2]A New generation of Brain-Computer Interface Based on Riemannian Geometry M. Congedo, A. Barachant, A. Andreev. Research report, 2013.
[3]Classification de potentiels evoques P300 par geometrie riemannienne pour les interfaces cerveau-machine EEG A. Barachant, M. Congedo, G. van Veen, and C. Jutten, 24eme colloque GRETSI, 2013.
- __init__(classes=None, estimator='scm', svd=None, **kwds)¶
Init.
- fit(X, y)¶
Fit.
Estimate the prototyped responses for each class.
- Parameters:
- Xndarray, shape (n_matrices, n_channels, n_times)
Multi-channel time-series.
- yndarray, shape (n_matrices,)
Labels for each matrix.
- Returns:
- selfERPCovariances instance
The ERPCovariances instance.
- fit_transform(X, y)¶
Fit and transform in a single function.
- Parameters:
- Xndarray, shape (n_matrices, n_channels, n_times)
Multi-channel time-series.
- yndarray, shape (n_matrices,)
Labels for each matrix.
- Returns:
- X_newndarray, shape (n_matrices, n_components, n_components)
Covariance matrices for ERP, where the size of matrices n_components is equal to (1 + n_classes) x n_channels if svd is None, and to n_channels + n_classes x min(svd, n_channels) otherwise.
- 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 Introducing the set_output API for an example on how to use the API.
- Parameters:
- transform{“default”, “pandas”, “polars”}, default=None
Configure output of transform and fit_transform.
“default”: Default output format of a transformer
“pandas”: DataFrame output
“polars”: Polars output
None: Transform configuration is unchanged
Added in version 1.4: “polars” option was added.
- 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 special form covariance matrices.
- Parameters:
- Xndarray, shape (n_matrices, n_channels, n_times)
Multi-channel time-series.
- Returns:
- X_newndarray, shape (n_matrices, n_components, n_components)
Covariance matrices for ERP, where the size of matrices n_components is equal to (1 + n_classes) x n_channels if svd is None, and to n_channels + n_classes x min(svd, n_channels) otherwise.