moabb.pipelines.classification.SSVEP_SSCOR#

class moabb.pipelines.classification.SSVEP_SSCOR(n_fbands=5, is_ensemble=True, estimator='scm')[source]#

Sum of Squared Correlations (SSCOR) for SSVEP detection [1].

SSCOR maximizes the sum of squared inter-trial correlations rather than raw covariances (as in TRCA). By normalizing each trial before computing the inter-trial covariance matrix, SSCOR directly optimizes the correlation metric used at prediction time.

Mathematical Formulation

For each stimulus frequency, SSCOR finds spatial filter \(\mathbf{w}\) that maximizes:

\[\hat{\mathbf{w}} = \arg\max_{\mathbf{w}} \sum_{h_1 \neq h_2} \text{corr}(\mathbf{w}^T \mathbf{X}^{(h_1)}, \mathbf{w}^T \mathbf{X}^{(h_2)})^2\]

This is solved as a generalized eigenvalue problem with normalized (variance-unit) covariance matrices instead of raw covariance.

Parameters:
  • n_fbands (int) – Number of sub-bands for filter bank decomposition. Defaults to 5.

  • is_ensemble (bool) – If True, use ensemble approach combining spatial filters from all classes. Defaults to True.

  • estimator (str) – Covariance estimator: ‘scm’, ‘lwf’, ‘oas’, or ‘schaefer’. Defaults to 'scm'.

classes_#

Encoded class labels, of shape (n_classes,).

Type:

numpy.ndarray

templates_#

Average templates, of shape (n_classes, n_fbands, n_channels, n_samples).

Type:

numpy.ndarray

weights_#

Spatial filter weights, of shape (n_fbands, n_classes, n_channels).

Type:

numpy.ndarray

References

[1]

Kumar, G. K. & Reddy, M. R. (2019). Designing a sum of squared correlations framework for enhancing SSVEP-based BCIs. IEEE Transactions on Neural Systems and Rehabilitation Engineering, 27(10), 2044-2050. https://doi.org/10.1109/TNSRE.2019.2940946

Notes

Added in version 1.2.0.

fit(X, y)[source]#

Extract spatial filters and templates.

Parameters:
  • X (mne.Epochs) – Training data as MNE Epochs object.

  • y (numpy.ndarray) – Label vector with frequency strings for each trial, of shape (n_trials,).

Returns:

self – Fitted instance.

Return type:

SSVEP_SSCOR

predict(X)[source]#

Predict class labels.

Parameters:

X (mne.Epochs) – Test data as MNE Epochs object.

Returns:

y_pred – Predicted labels.

Return type:

list of int

predict_proba(X)[source]#

Predict class probabilities.

Parameters:

X (mne.Epochs) – Test data as MNE Epochs object.

Returns:

y_pred – Probabilities per class, of shape (n_trials, n_classes).

Return type:

numpy.ndarray

set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') SSVEP_SSCOR[source]#

Configure whether metadata should be requested to be passed to the score method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to score.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters:

sample_weight (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for sample_weight parameter in score.

Returns:

self – The updated object.

Return type:

object