pyriemann.spatialfilters.BilinearFilter¶
- class pyriemann.spatialfilters.BilinearFilter(filters, log=False)¶
Bilinear spatial filter.
Bilinear spatial filter for SPD matrices allows to define a custom spatial filter for bilinear projection of the data:
\[\mathbf{Cf}_i = \mathbf{V} \mathbf{C}_i \mathbf{V}^T\]If log parameter is set to true, will return the log of the diagonal:
\[\mathbf{cf}_i = \log [ \mathrm{diag} (\mathbf{Cf}_i) ]\]- Parameters:
- filtersndarray, shape (n_filters, n_channels)
The filters for bilinear transform.
- logbool, default=False
If true, return the log variance, otherwise return the spatially filtered covariance matrices.
- Attributes:
- filters_ndarray, shape (n_filters, n_channels)
If fit, the filter components used to decompose the data for each event type, concatenated.
- __init__(filters, log=False)¶
Init.
- fit(X, y)¶
Train BilinearFilter spatial filters.
- Parameters:
- Xndarray, shape (n_trials, n_channels, n_channels)
Set of covariance matrices.
- yndarray, shape (n_trials,)
Labels for each trial.
- Returns:
- selfBilinearFilter instance
The BilinearFilter 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_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 sphx_glr_auto_examples_miscellaneous_plot_set_output.py for an example on how to use the API.
- Parameters:
- transform{“default”, “pandas”}, default=None
Configure output of transform and fit_transform.
“default”: Default output format of a transformer
“pandas”: DataFrame output
None: Transform configuration is unchanged
- 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:
- Xfndarray, shape (n_trials, n_filters) or ndarray, shape (n_trials, n_filters, n_filters)
Set of spatialy filtered log-variance or covariance, depending on the ‘log’ input parameter.