mne.decoding.
CSP
(n_components=4, reg=None, log=True, cov_est='concat')¶M/EEG signal decomposition using the Common Spatial Patterns (CSP).
This object can be used as a supervised decomposition to estimate spatial filters for feature extraction in a 2 class decoding problem. CSP in the context of EEG was first described in [1]; a comprehensive tutorial on CSP can be found in [2].
Parameters: | n_components : int (default 4)
reg : float | str | None (default None)
log : bool (default True)
cov_est : str (default ‘concat’)
|
---|---|
Attributes: | filters_ : ndarray, shape (n_channels, n_channels)
patterns_ : ndarray, shape (n_channels, n_channels)
mean_ : ndarray, shape (n_channels,)
std_ : ndarray, shape (n_channels,)
|
References
Methods
fit (epochs_data, y) |
Estimate the CSP decomposition on epochs. |
fit_transform (X[, y]) |
Fit to data, then transform it |
get_params ([deep]) |
Return all parameters (mimics sklearn API). |
plot_filters (info[, components, ch_type, ...]) |
Plot topographic filters of CSP components. |
plot_patterns (info[, components, ch_type, ...]) |
Plot topographic patterns of CSP components. |
set_params (**params) |
Set parameters (mimics sklearn API). |
transform (epochs_data[, y]) |
Estimate epochs sources given the CSP filters. |
__init__
(n_components=4, reg=None, log=True, cov_est='concat')¶Init of CSP.
fit
(epochs_data, y)¶Estimate the CSP decomposition on epochs.
Parameters: | epochs_data : ndarray, shape (n_epochs, n_channels, n_times)
y : array, shape (n_epochs,)
|
---|---|
Returns: | self : instance of CSP
|
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: | 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)¶Return all parameters (mimics sklearn API).
Parameters: | deep: boolean, optional :
|
---|
plot_filters
(info, components=None, ch_type=None, layout=None, vmin=None, vmax=None, cmap='RdBu_r', sensors=True, colorbar=True, scale=None, scale_time=1, unit=None, res=64, size=1, cbar_fmt='%3.1f', name_format='CSP%01d', proj=False, show=True, show_names=False, title=None, mask=None, mask_params=None, outlines='head', contours=6, image_interp='bilinear', average=None, head_pos=None)¶Plot topographic filters of CSP components.
The CSP 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
sensors : bool | str
colorbar : bool
scale : dict | float | None
scale_time : float | None
unit : dict | str | None
res : int
size : float
cbar_fmt : str
name_format : str
proj : bool | ‘interactive’
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 | False | None
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, scale=None, scale_time=1, unit=None, res=64, size=1, cbar_fmt='%3.1f', name_format='CSP%01d', proj=False, show=True, show_names=False, title=None, mask=None, mask_params=None, outlines='head', contours=6, image_interp='bilinear', average=None, head_pos=None)¶Plot topographic patterns of CSP components.
The CSP 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
sensors : bool | str
colorbar : bool
scale : dict | float | None
scale_time : float | None
unit : dict | str | None
res : int
size : float
cbar_fmt : str
name_format : str
proj : bool | ‘interactive’
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 | False | None
image_interp : str
average : float | None
head_pos : dict | None
|
---|---|
Returns: | fig : instance of matplotlib.figure.Figure
|
set_params
(**params)¶Set parameters (mimics sklearn API).
transform
(epochs_data, y=None)¶Estimate epochs sources given the CSP filters.
Parameters: | epochs_data : array, shape (n_epochs, n_channels, n_times)
y : None
|
---|---|
Returns: | X : ndarray of shape (n_epochs, n_sources)
|