pyriemann.spatialfilters.Xdawn¶
- class pyriemann.spatialfilters.Xdawn(nfilter=4, classes=None, estimator='scm', baseline_cov=None)¶
Xdawn algorithm.
Xdawn [1] is a spatial filtering method designed to improve the signal to signal + noise ratio (SSNR) of the ERP responses. Xdawn was originaly designed for P300 evoked potential by enhancing the target response with respect to the non-target response [2]. This implementation is a generalization to any type of ERP.
- Parameters
- nfilterint, default=4
The number of components to decompose M/EEG signals.
- classeslist of int | None, default=None
List of classes to take into account for Xdawn. If None, all classes will be accounted.
- estimatorstring, default=’scm’
Covariance matrix estimator, see
pyriemann.utils.covariance.covariances()
.- baseline_covNone | array, shape(n_channels, n_channels), default=None
Covariance matrix to which the average signals are compared. If None, the baseline covariance is computed across all trials and time samples.
See also
XdawnCovariances
References
- 1
xDAWN algorithm to enhance evoked potentials: application to brain-computer interface B. Rivet, A. Souloumiac, V. Attina, and G. Gibert. IEEE Transactions on Biomedical Engineering, 2009, 56 (8), pp.2035-43.
- 2
Theoretical analysis of xDAWN algorithm: application to an efficient sensor selection in a P300 BCI B. Rivet, H. Cecotti, A. Souloumiac, E. Maby, J. Mattout. EUSIPCO 2011 19th European Signal Processing Conference, Aug 2011, Barcelone, Spain. pp.1382-1386.
- Attributes
- classes_ndarray, shape (n_classes,)
Labels for each class.
- filters_ndarray, shape (n_classes x min(n_channels, n_filters), n_channels)
If fit, the Xdawn components used to decompose the data for each event type, concatenated.
- patterns_ndarray, shape (n_classes x min(n_channels, n_filters), n_channels)
If fit, the Xdawn patterns used to restore M/EEG signals for each event type, concatenated.
- evokeds_ndarray, shape (n_classes x min(n_channels, n_filters), n_times)
If fit, the evoked response for each event type, concatenated.
- __init__(nfilter=4, classes=None, estimator='scm', baseline_cov=None)¶
Init.
- fit(X, y)¶
Train Xdawn spatial filters.
- Parameters
- Xndarray, shape (n_trials, n_channels, n_times)
Set of trials.
- yndarray, shape (n_trials,)
Labels for each trial.
- Returns
- selfXdawn instance
The Xdawn 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_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_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)¶
Apply spatial filters.
- Parameters
- Xndarray, shape (n_trials, n_channels, n_times)
Set of trials.
- Returns
- Xfndarray, shape (n_trials, n_classes x min(n_channels, n_filters), n_times)
Set of spatialy filtered trials.