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:
- classes_#
Encoded class labels.
- Type:
ndarray of shape (n_classes,)
- templates_#
Average templates.
- Type:
ndarray of shape (n_classes, n_fbands, n_channels, n_samples)
- weights_#
Spatial filter weights.
- Type:
ndarray of shape (n_fbands, n_classes, n_channels)
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 (ndarray of shape (n_trials,)) – Label vector with frequency strings for each trial.
- Returns:
self – Fitted instance.
- Return type:
- predict_proba(X)[source]#
Predict class probabilities.
- Parameters:
X (MNE Epochs) – Test data as MNE Epochs object.
- Returns:
y_pred – Probabilities per class.
- Return type:
ndarray of shape (n_trials, n_classes)
- set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') SSVEP_SSCOR[source]#
Configure whether metadata should be requested to be passed to the
scoremethod.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(seesklearn.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 toscoreif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it toscore.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.