moabb.pipelines.classification.SSVEP_itCCA#
- class moabb.pipelines.classification.SSVEP_itCCA[source]#
Individual Template CCA (itCCA) for SSVEP detection [1].
itCCA replaces the sinusoidal reference signals used in standard CCA with individual templates computed by averaging training trials for each stimulus frequency. This captures subject-specific SSVEP morphology that sinusoidal references cannot model.
Mathematical Formulation
For each stimulus frequency \(f_n\), the individual template is computed as the average across all \(N_t\) training trials:
\[\bar{\mathbf{X}}_n = \frac{1}{N_t} \sum_{h=1}^{N_t} \mathbf{X}_n^{(h)}\]For a test signal \(\mathbf{X}\), CCA is computed between the test data and each individual template \(\bar{\mathbf{X}}_n\):
\[\rho_n = \max_{\mathbf{w}_x, \mathbf{w}_y} \text{corr}(\mathbf{X}^T \mathbf{w}_x, \bar{\mathbf{X}}_n^T \mathbf{w}_y)\]Classification Rule
\[\hat{f} = \arg\max_{n} \rho_n\]- classes_#
Class labels in the same label space as
y.- Type:
ndarray of shape (n_classes,)
- le_#
Fitted label encoder.
- Type:
LabelEncoder
- templates_#
Dictionary mapping frequency strings to averaged templates of shape
(n_channels, n_times).- Type:
References
[1]Nakanishi, M., Wang, Y., Wang, Y.-T., Mitsukura, Y., & Jung, T.-P. (2014). A high-speed brain speller using steady-state visual evoked potentials. International Journal of Neural Systems, 24(06), 1450019. https://doi.org/10.1142/S0129065714500191
Notes
Added in version 1.2.0.
- fit(X, y, sample_weight=None)[source]#
Compute individual templates by averaging trials per class.
- Parameters:
X (MNE Epochs) – Training data as MNE Epochs object.
y (ndarray of shape (n_trials,)) – Label vector with frequency strings for each trial.
sample_weight (Unused) – Only for compatibility with scikit-learn.
- Returns:
self – Fitted instance.
- Return type:
- predict_proba(X)[source]#
Predict class probabilities from correlation coefficients.
- Parameters:
X (MNE Epochs) – Test data as MNE Epochs object.
- Returns:
P – Probability of each class for each trial.
- Return type:
ndarray of shape (n_trials, n_classes)
- set_fit_request(*, sample_weight: bool | None | str = '$UNCHANGED$') SSVEP_itCCA[source]#
Configure whether metadata should be requested to be passed to the
fitmethod.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 tofitif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it tofit.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.
- set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') SSVEP_itCCA[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.