mne.decoding.
SPoC
(n_components=4, reg=None, log=None, transform_into='average_power')[source]¶Implementation of the SPoC spatial filtering.
Source Power Comodulation (SPoC) [R130130] 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 correlates with the target variable.
SPoC can be seen as an extension of the CSP driven by a continuous variable rather than a discrete variable. Typical applications include extraction of motor patterns using EMG power or audio patterns using sound envelope.
Parameters: | n_components : int
reg : float | str | None, defaults to None
log : None | bool, defaults to None
transform_into : {‘average_power’, ‘csp_space’}
|
---|
See also
References
[R130130] | (1, 2) Dahne, S., Meinecke, F. C., Haufe, S., Hohne, J., Tangermann, M., Muller, K. R., & Nikulin, V. V. (2014). SPoC: a novel framework for relating the amplitude of neuronal oscillations to behaviorally relevant parameters. NeuroImage, 86, 111-122. |
Attributes
``filters_`` | (ndarray, shape (n_components, n_channels)) If fit, the SPoC spatial filters, else None. |
``patterns_`` | (ndarray, shape (n_components, n_channels)) If fit, the SPoC spatial patterns, else None. |
``mean_`` | (ndarray, shape (n_components,)) If fit, the mean squared power for each component. |
``std_`` | (ndarray, shape (n_components,)) If fit, the std squared power for each component. |
Methods
__hash__ () <==> hash(x) |
|
fit (X, y) |
Estimate the SPoC decomposition on epochs. |
fit_transform (X[, y]) |
Fit to data, then transform it. |
get_params ([deep]) |
Get parameters for this estimator. |
plot_filters (info[, components, ch_type, …]) |
Plot topographic filters of components. |
plot_patterns (info[, components, ch_type, …]) |
Plot topographic patterns of components. |
set_params (**params) |
Set the parameters of this estimator. |
transform (X) |
Estimate epochs sources given the SPoC filters. |
__hash__
() <==> hash(x)¶fit
(X, y)[source]¶Estimate the SPoC decomposition on epochs.
Parameters: | X : ndarray, shape (n_epochs, n_channels, n_times)
y : array, shape (n_epochs,)
|
---|---|
Returns: | self : instance of SPoC
|
fit_transform
(X, y=None, **fit_params)[source]¶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: | X : numpy array of shape [n_samples, n_features]
y : numpy array of shape [n_samples]
|
---|---|
Returns: | X_new : numpy array of shape [n_samples, n_features_new]
|
get_params
(deep=True)[source]¶Get parameters for this estimator.
Parameters: | deep : boolean, optional
|
---|---|
Returns: | params : mapping of string to any
|
plot_filters
(info, components=None, ch_type=None, layout=None, vmin=None, vmax=None, cmap='RdBu_r', sensors=True, colorbar=True, scalings=None, units='a.u.', res=64, size=1, cbar_fmt='%3.1f', name_format='CSP%01d', show=True, show_names=False, title=None, mask=None, mask_params=None, outlines='head', contours=6, image_interp='bilinear', average=None, head_pos=None, scale=None, unit=None)[source]¶Plot topographic filters of components.
The filters are used to extract discriminant neural sources from the measured data (a.k.a. the backward model).
Parameters: | info : instance of Info
components : float | array of floats | None.
ch_type : ‘mag’ | ‘grad’ | ‘planar1’ | ‘planar2’ | ‘eeg’ | None
layout : None | Layout
vmin : float | callable
vmax : float | callable
cmap : matplotlib colormap | (colormap, bool) | ‘interactive’ | None
sensors : bool | str
colorbar : bool
scalings : dict | float | None
units : dict | str | None
res : int
size : float
cbar_fmt : str
name_format : str
show : bool
show_names : bool | callable
title : str | None
mask : ndarray of bool, shape (n_channels, n_times) | None
mask_params : dict | None
outlines : ‘head’ | ‘skirt’ | dict | None
contours : int | array of float
image_interp : str
average : float | None
head_pos : dict | None
|
---|---|
Returns: | fig : instance of matplotlib.figure.Figure
|
plot_patterns
(info, components=None, ch_type=None, layout=None, vmin=None, vmax=None, cmap='RdBu_r', sensors=True, colorbar=True, scalings=None, units='a.u.', res=64, size=1, cbar_fmt='%3.1f', name_format='CSP%01d', show=True, show_names=False, title=None, mask=None, mask_params=None, outlines='head', contours=6, image_interp='bilinear', average=None, head_pos=None, scale=None, unit=None)[source]¶Plot topographic patterns of components.
The patterns explain how the measured data was generated from the neural sources (a.k.a. the forward model).
Parameters: | info : instance of Info
components : float | array of floats | None.
ch_type : ‘mag’ | ‘grad’ | ‘planar1’ | ‘planar2’ | ‘eeg’ | None
layout : None | Layout
vmin : float | callable
vmax : float | callable
cmap : matplotlib colormap | (colormap, bool) | ‘interactive’ | None
sensors : bool | str
colorbar : bool
scalings : dict | float | None
units : dict | str | None
res : int
size : float
cbar_fmt : str
name_format : str
show : bool
show_names : bool | callable
title : str | None
mask : ndarray of bool, shape (n_channels, n_times) | None
mask_params : dict | None
outlines : ‘head’ | ‘skirt’ | dict | None
contours : int | array of float
image_interp : str
average : float | None
head_pos : dict | None
|
---|---|
Returns: | fig : instance of matplotlib.figure.Figure
|
set_params
(**params)[source]¶Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as pipelines). The latter have parameters of the form
<component>__<parameter>
so that it’s possible to update each
component of a nested object.
Returns
——-
self
transform
(X)[source]¶Estimate epochs sources given the SPoC filters.
Parameters: | X : array, shape (n_epochs, n_channels, n_times)
|
---|---|
Returns: | X : ndarray
|