pyriemann.spatialfilters.SPoC¶
- class pyriemann.spatialfilters.SPoC(nfilter=4, metric='euclid', log=True, ajd_method='ajd_pham')¶
SPoC spatial filtering with covariance matrices as inputs.
Source Power Comodulation (SPoC) [1] allows to extract spatial filters and patterns by using a target (continuous) variable in the decomposition process in order to give preference to components whose power comodulates with the target variable.
SPoC can be seen as an extension of the
pyriemann.spatialfilters.CSP
driven by a continuous variable rather than a discrete (often binary) variable. Typical applications include extraction of motor patterns using EMG power or audio paterns using sound envelope.- Parameters:
- nfilterint, default=4
The number of components to decompose M/EEG signals.
- metricstr, default=”euclid”
Metric used for the estimation of mean covariance matrices. For the list of supported metrics, see
pyriemann.utils.mean.mean_covariance()
.- logbool, default=True
If true, return the log variance, otherwise return the spatially filtered covariance matrices.
- Attributes:
- filters_ndarray, shape (min(n_channels, n_filters), n_channels)
If fit, the SPoC spatial filters.
- patterns_ndarray, shape (min(n_channels, n_filters), n_channels)
If fit, the SPoC spatial patterns.
See also
Notes
Added in version 0.2.4.
References
[1]SPoC: a novel framework for relating the amplitude of neuronal oscillations to behaviorally relevant parameters S. Dahne, F. C. Meinecke, S. Haufe, J. Hohne, M. Tangermann, K-R. Muller, and V. V. Nikulin. NeuroImage, 86, 111-122, 2014.
- __init__(nfilter=4, metric='euclid', log=True, ajd_method='ajd_pham')¶
Init.
- fit(X, y)¶
Train spatial filters.
- Parameters:
- Xndarray, shape (n_trials, n_channels, n_channels)
Set of covariance matrices.
- yndarray, shape (n_trials,)
Target variable for each trial.
- Returns:
- selfSPoC instance
The SPoC instance.
- fit_transform(X, y)¶
Fit and transform in a single function.
- Parameters:
- Xndarray, shape (n_trials, n_channels, n_channels)
Set of covariance matrices.
- yndarray, shape (n_trials,)
Labels for each trial.
- Returns:
- X_newndarray, shape (n_trials, n_filters) or ndarray, shape (n_trials, n_filters, n_filters)
Set of spatially filtered log-variance or covariance, depending on the log input parameter.
- 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)¶
Apply spatial filters.
- Parameters:
- Xndarray, shape (n_trials, n_channels, n_channels)
Set of covariance matrices.
- Returns:
- X_newndarray, shape (n_trials, n_filters) or ndarray, shape (n_trials, n_filters, n_filters)
Set of spatially filtered log-variance or covariance, depending on the log input parameter.