Cross-Subject SSVEP

This example shows how to perform a cross-subject analysis on an SSVEP dataset. We will compare two pipelines :

  • Riemannian Geometry

  • CCA

We will use the SSVEP paradigm, which uses the AUC as metric.

# Authors: Sylvain Chevallier <sylvain.chevallier@uvsq.fr>
#
# License: BSD (3-clause)

import warnings

import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from pyriemann.estimation import Covariances
from pyriemann.tangentspace import TangentSpace
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import make_pipeline

import moabb
from moabb.datasets import SSVEPExo
from moabb.evaluations import CrossSubjectEvaluation
from moabb.paradigms import SSVEP, FilterBankSSVEP
from moabb.pipelines import SSVEP_CCA, SSVEP_TRCA, ExtendedSSVEPSignal


warnings.simplefilter(action="ignore", category=FutureWarning)
warnings.simplefilter(action="ignore", category=RuntimeWarning)
moabb.set_log_level("info")

Out:

/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/seaborn/cm.py:1582: UserWarning: Trying to register the cmap 'rocket' which already exists.
  mpl_cm.register_cmap(_name, _cmap)
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/seaborn/cm.py:1583: UserWarning: Trying to register the cmap 'rocket_r' which already exists.
  mpl_cm.register_cmap(_name + "_r", _cmap_r)
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/seaborn/cm.py:1582: UserWarning: Trying to register the cmap 'mako' which already exists.
  mpl_cm.register_cmap(_name, _cmap)
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/seaborn/cm.py:1583: UserWarning: Trying to register the cmap 'mako_r' which already exists.
  mpl_cm.register_cmap(_name + "_r", _cmap_r)
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/seaborn/cm.py:1582: UserWarning: Trying to register the cmap 'icefire' which already exists.
  mpl_cm.register_cmap(_name, _cmap)
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/seaborn/cm.py:1583: UserWarning: Trying to register the cmap 'icefire_r' which already exists.
  mpl_cm.register_cmap(_name + "_r", _cmap_r)
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/seaborn/cm.py:1582: UserWarning: Trying to register the cmap 'vlag' which already exists.
  mpl_cm.register_cmap(_name, _cmap)
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/seaborn/cm.py:1583: UserWarning: Trying to register the cmap 'vlag_r' which already exists.
  mpl_cm.register_cmap(_name + "_r", _cmap_r)
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/seaborn/cm.py:1582: UserWarning: Trying to register the cmap 'flare' which already exists.
  mpl_cm.register_cmap(_name, _cmap)
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/seaborn/cm.py:1583: UserWarning: Trying to register the cmap 'flare_r' which already exists.
  mpl_cm.register_cmap(_name + "_r", _cmap_r)
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/seaborn/cm.py:1582: UserWarning: Trying to register the cmap 'crest' which already exists.
  mpl_cm.register_cmap(_name, _cmap)
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/seaborn/cm.py:1583: UserWarning: Trying to register the cmap 'crest_r' which already exists.
  mpl_cm.register_cmap(_name + "_r", _cmap_r)

Loading Dataset

We will load the data from the first 2 subjects of the SSVEP_Exo dataset and compare two algorithms on this set. One of the algorithms could only process class associated with a stimulation frequency, we will thus drop the resting class. As the resting class is the last defined class, picking the first three classes (out of four) allows to focus only on the stimulation frequency.

Choose Paradigm

We define the paradigms (SSVEP, SSSVEP_TRCA and FilterBankSSVEP) and use the dataset SSVEPExo. The SSVEP paradigm applied a bandpass filter (10-25 Hz) on the data, SSVEP_TRCA applied a bandpass filter (1-110 Hz) which correspond to almost no filtering, while the FilterBankSSVEP paradigm uses as many bandpass filters as there are stimulation frequencies (here 2). For each stimulation frequency the EEG is filtered with a 1 Hz-wide bandpass filter centered on the frequency. This results in n_classes copies of the signal, filtered for each class, as used in the filterbank motor imagery paradigms.

paradigm = SSVEP(fmin=10, fmax=25, n_classes=3)
paradigm_TRCA = SSVEP(fmin=1, fmax=110, n_classes=3)
paradigm_fb = FilterBankSSVEP(filters=None, n_classes=3)

Classes are defined by the frequency of the stimulation, here we use the first two frequencies of the dataset, 13 and 17 Hz. The evaluation function uses a LabelEncoder, transforming them to 0 and 1

freqs = paradigm.used_events(dataset)

Create Pipelines

Pipelines must be a dict of sklearn pipeline transformer. The first pipeline uses Riemannian geometry, by building an extended covariance matrices from the signal filtered around the considered frequency and applying a logistic regression in the tangent plane. The second pipeline relies on the above defined CCA classifier. The third pipeline relies on the TRCA algorithm.

pipelines_fb = {}
pipelines_fb["RG+LogReg"] = make_pipeline(
    ExtendedSSVEPSignal(),
    Covariances(estimator="lwf"),
    TangentSpace(),
    LogisticRegression(solver="lbfgs", multi_class="auto"),
)

pipelines = {}
pipelines["CCA"] = make_pipeline(SSVEP_CCA(interval=interval, freqs=freqs, n_harmonics=3))

pipelines_TRCA = {}
pipelines_TRCA["TRCA"] = make_pipeline(
    SSVEP_TRCA(interval=interval, freqs=freqs, n_fbands=5)
)

Evaluation

The evaluation will return a DataFrame containing an accuracy score for each subject / session of the dataset, and for each pipeline.

Results are saved into the database, so that if you add a new pipeline, it will not run again the evaluation unless a parameter has changed. Results can be overwritten if necessary.

overwrite = False  # set to True if we want to overwrite cached results

evaluation = CrossSubjectEvaluation(
    paradigm=paradigm, datasets=dataset, overwrite=overwrite
)
results = evaluation.process(pipelines)

Out:

  0%|                                              | 0.00/2.06M [00:00<?, ?B/s]
  2%|▌                                     | 31.7k/2.06M [00:00<00:08, 239kB/s]
  3%|█▏                                    | 64.5k/2.06M [00:00<00:08, 246kB/s]
  6%|██▏                                    | 114k/2.06M [00:00<00:06, 304kB/s]
  7%|██▊                                    | 146k/2.06M [00:00<00:06, 282kB/s]
  9%|███▍                                   | 179k/2.06M [00:00<00:06, 271kB/s]
 10%|████                                   | 212k/2.06M [00:00<00:06, 264kB/s]
 12%|████▋                                  | 245k/2.06M [00:00<00:06, 259kB/s]
 14%|█████▎                                 | 278k/2.06M [00:01<00:06, 256kB/s]
 15%|█████▉                                 | 310k/2.06M [00:01<00:06, 254kB/s]
 17%|██████▌                                | 343k/2.06M [00:01<00:06, 253kB/s]
 18%|███████▏                               | 376k/2.06M [00:01<00:06, 252kB/s]
 20%|███████▊                               | 409k/2.06M [00:01<00:06, 252kB/s]
 21%|████████▎                              | 441k/2.06M [00:01<00:06, 251kB/s]
 23%|████████▉                              | 474k/2.06M [00:01<00:06, 251kB/s]
 25%|█████████▌                             | 507k/2.06M [00:01<00:06, 250kB/s]
 26%|██████████▏                            | 540k/2.06M [00:02<00:06, 250kB/s]
 28%|██████████▊                            | 572k/2.06M [00:02<00:05, 250kB/s]
 29%|███████████▍                           | 605k/2.06M [00:02<00:05, 250kB/s]
 31%|████████████                           | 638k/2.06M [00:02<00:05, 250kB/s]
 33%|████████████▋                          | 671k/2.06M [00:02<00:05, 250kB/s]
 34%|█████████████▎                         | 703k/2.06M [00:02<00:05, 250kB/s]
 36%|█████████████▉                         | 736k/2.06M [00:02<00:05, 250kB/s]
 37%|██████████████▌                        | 769k/2.06M [00:03<00:05, 250kB/s]
 39%|███████████████▏                       | 802k/2.06M [00:03<00:05, 250kB/s]
 41%|███████████████▊                       | 835k/2.06M [00:03<00:04, 250kB/s]
 42%|████████████████▍                      | 867k/2.06M [00:03<00:04, 250kB/s]
 44%|█████████████████                      | 900k/2.06M [00:03<00:04, 250kB/s]
 45%|█████████████████▋                     | 933k/2.06M [00:03<00:04, 250kB/s]
 47%|██████████████████▎                    | 966k/2.06M [00:03<00:04, 250kB/s]
 49%|██████████████████▉                    | 998k/2.06M [00:03<00:04, 250kB/s]
 50%|███████████████████                   | 1.03M/2.06M [00:04<00:04, 250kB/s]
 52%|███████████████████▋                  | 1.06M/2.06M [00:04<00:03, 250kB/s]
 53%|████████████████████▎                 | 1.10M/2.06M [00:04<00:03, 250kB/s]
 55%|████████████████████▉                 | 1.13M/2.06M [00:04<00:03, 250kB/s]
 57%|█████████████████████▍                | 1.16M/2.06M [00:04<00:03, 250kB/s]
 58%|██████████████████████                | 1.20M/2.06M [00:04<00:03, 249kB/s]
 60%|██████████████████████▋               | 1.23M/2.06M [00:04<00:03, 249kB/s]
 61%|███████████████████████▎              | 1.26M/2.06M [00:04<00:03, 250kB/s]
 63%|███████████████████████▉              | 1.29M/2.06M [00:05<00:03, 250kB/s]
 65%|████████████████████████▌             | 1.33M/2.06M [00:05<00:02, 250kB/s]
 66%|█████████████████████████             | 1.36M/2.06M [00:05<00:02, 250kB/s]
 68%|█████████████████████████▋            | 1.39M/2.06M [00:05<00:02, 250kB/s]
 69%|██████████████████████████▎           | 1.42M/2.06M [00:05<00:02, 249kB/s]
 71%|██████████████████████████▉           | 1.46M/2.06M [00:05<00:02, 250kB/s]
 72%|███████████████████████████▌          | 1.49M/2.06M [00:05<00:02, 250kB/s]
 74%|████████████████████████████▏         | 1.52M/2.06M [00:06<00:02, 250kB/s]
 76%|████████████████████████████▊         | 1.56M/2.06M [00:06<00:02, 250kB/s]
 77%|█████████████████████████████▎        | 1.59M/2.06M [00:06<00:01, 250kB/s]
 79%|█████████████████████████████▉        | 1.62M/2.06M [00:06<00:01, 250kB/s]
 80%|██████████████████████████████▌       | 1.65M/2.06M [00:06<00:01, 250kB/s]
 82%|███████████████████████████████▏      | 1.69M/2.06M [00:06<00:01, 250kB/s]
 84%|███████████████████████████████▊      | 1.72M/2.06M [00:06<00:01, 250kB/s]
 85%|████████████████████████████████▍     | 1.75M/2.06M [00:06<00:01, 250kB/s]
 87%|█████████████████████████████████     | 1.78M/2.06M [00:07<00:01, 250kB/s]
 88%|█████████████████████████████████▌    | 1.82M/2.06M [00:07<00:00, 250kB/s]
 90%|██████████████████████████████████▏   | 1.85M/2.06M [00:07<00:00, 250kB/s]
 92%|██████████████████████████████████▊   | 1.88M/2.06M [00:07<00:00, 250kB/s]
 93%|███████████████████████████████████▍  | 1.92M/2.06M [00:07<00:00, 250kB/s]
 95%|████████████████████████████████████  | 1.95M/2.06M [00:07<00:00, 250kB/s]
 96%|████████████████████████████████████▋ | 1.98M/2.06M [00:07<00:00, 250kB/s]
 98%|█████████████████████████████████████▏| 2.01M/2.06M [00:08<00:00, 250kB/s]
100%|█████████████████████████████████████▊| 2.05M/2.06M [00:08<00:00, 249kB/s]
  0%|                                              | 0.00/2.06M [00:00<?, ?B/s]
100%|█████████████████████████████████████| 2.06M/2.06M [00:00<00:00, 4.53GB/s]

  0%|                                              | 0.00/2.82M [00:00<?, ?B/s]
  1%|▍                                     | 31.7k/2.82M [00:00<00:11, 252kB/s]
  3%|█                                     | 80.9k/2.82M [00:00<00:08, 332kB/s]
  4%|█▌                                     | 115k/2.82M [00:00<00:08, 302kB/s]
  5%|██                                     | 146k/2.82M [00:00<00:09, 281kB/s]
  6%|██▍                                    | 179k/2.82M [00:00<00:09, 273kB/s]
  8%|██▉                                    | 212k/2.82M [00:00<00:09, 268kB/s]
  9%|███▍                                   | 245k/2.82M [00:00<00:09, 265kB/s]
 10%|███▊                                   | 278k/2.82M [00:01<00:09, 263kB/s]
 11%|████▎                                  | 310k/2.82M [00:01<00:09, 261kB/s]
 12%|████▊                                  | 343k/2.82M [00:01<00:09, 261kB/s]
 13%|█████▏                                 | 376k/2.82M [00:01<00:09, 260kB/s]
 15%|█████▋                                 | 409k/2.82M [00:01<00:09, 260kB/s]
 16%|██████                                 | 441k/2.82M [00:01<00:09, 259kB/s]
 17%|██████▌                                | 474k/2.82M [00:01<00:09, 258kB/s]
 18%|███████                                | 507k/2.82M [00:01<00:08, 258kB/s]
 19%|███████▍                               | 540k/2.82M [00:02<00:08, 258kB/s]
 20%|███████▉                               | 572k/2.82M [00:02<00:08, 257kB/s]
 21%|████████▍                              | 605k/2.82M [00:02<00:08, 258kB/s]
 23%|████████▊                              | 638k/2.82M [00:02<00:13, 160kB/s]
 24%|█████████▎                             | 671k/2.82M [00:02<00:11, 181kB/s]
 25%|█████████▋                             | 703k/2.82M [00:02<00:10, 198kB/s]
 26%|██████████▏                            | 736k/2.82M [00:03<00:09, 213kB/s]
 27%|██████████▋                            | 769k/2.82M [00:03<00:09, 224kB/s]
 28%|███████████                            | 802k/2.82M [00:03<00:08, 233kB/s]
 30%|███████████▌                           | 835k/2.82M [00:03<00:08, 239kB/s]
 31%|████████████                           | 867k/2.82M [00:03<00:07, 244kB/s]
 32%|████████████▍                          | 900k/2.82M [00:03<00:07, 247kB/s]
 33%|████████████▉                          | 933k/2.82M [00:03<00:07, 250kB/s]
 34%|█████████████▎                         | 966k/2.82M [00:03<00:07, 252kB/s]
 35%|█████████████▊                         | 998k/2.82M [00:04<00:07, 253kB/s]
 37%|█████████████▉                        | 1.03M/2.82M [00:04<00:07, 254kB/s]
 38%|██████████████▎                       | 1.06M/2.82M [00:04<00:06, 255kB/s]
 39%|██████████████▊                       | 1.10M/2.82M [00:04<00:06, 255kB/s]
 40%|███████████████▏                      | 1.13M/2.82M [00:04<00:06, 255kB/s]
 41%|███████████████▋                      | 1.16M/2.82M [00:04<00:06, 256kB/s]
 42%|████████████████▏                     | 1.20M/2.82M [00:04<00:06, 256kB/s]
 44%|████████████████▌                     | 1.23M/2.82M [00:04<00:06, 256kB/s]
 45%|█████████████████                     | 1.26M/2.82M [00:05<00:06, 257kB/s]
 46%|█████████████████▍                    | 1.29M/2.82M [00:05<00:05, 257kB/s]
 47%|█████████████████▉                    | 1.33M/2.82M [00:05<00:05, 257kB/s]
 48%|██████████████████▎                   | 1.36M/2.82M [00:05<00:05, 257kB/s]
 49%|██████████████████▊                   | 1.39M/2.82M [00:05<00:05, 257kB/s]
 51%|███████████████████▏                  | 1.42M/2.82M [00:05<00:05, 257kB/s]
 52%|███████████████████▋                  | 1.46M/2.82M [00:05<00:05, 257kB/s]
 53%|████████████████████                  | 1.49M/2.82M [00:05<00:05, 255kB/s]
 54%|████████████████████▌                 | 1.52M/2.82M [00:06<00:05, 255kB/s]
 55%|████████████████████▉                 | 1.56M/2.82M [00:06<00:04, 256kB/s]
 56%|█████████████████████▍                | 1.59M/2.82M [00:06<00:04, 256kB/s]
 58%|█████████████████████▉                | 1.62M/2.82M [00:06<00:04, 257kB/s]
 59%|██████████████████████▎               | 1.65M/2.82M [00:06<00:04, 257kB/s]
 60%|██████████████████████▊               | 1.69M/2.82M [00:06<00:04, 257kB/s]
 61%|███████████████████████▏              | 1.72M/2.82M [00:06<00:04, 257kB/s]
 62%|███████████████████████▋              | 1.75M/2.82M [00:07<00:04, 257kB/s]
 63%|████████████████████████              | 1.78M/2.82M [00:07<00:04, 256kB/s]
 65%|████████████████████████▌             | 1.82M/2.82M [00:07<00:03, 256kB/s]
 66%|████████████████████████▉             | 1.85M/2.82M [00:07<00:03, 256kB/s]
 67%|█████████████████████████▍            | 1.88M/2.82M [00:07<00:03, 256kB/s]
 68%|█████████████████████████▊            | 1.92M/2.82M [00:07<00:03, 257kB/s]
 69%|██████████████████████████▎           | 1.95M/2.82M [00:07<00:03, 257kB/s]
 70%|██████████████████████████▋           | 1.98M/2.82M [00:07<00:03, 257kB/s]
 72%|███████████████████████████▏          | 2.01M/2.82M [00:08<00:03, 258kB/s]
 73%|███████████████████████████▋          | 2.05M/2.82M [00:08<00:02, 258kB/s]
 74%|████████████████████████████          | 2.08M/2.82M [00:08<00:02, 258kB/s]
 75%|████████████████████████████▌         | 2.11M/2.82M [00:08<00:02, 258kB/s]
 76%|████████████████████████████▉         | 2.15M/2.82M [00:08<00:02, 258kB/s]
 77%|█████████████████████████████▍        | 2.18M/2.82M [00:08<00:02, 258kB/s]
 79%|█████████████████████████████▊        | 2.21M/2.82M [00:08<00:02, 258kB/s]
 80%|██████████████████████████████▎       | 2.24M/2.82M [00:08<00:02, 258kB/s]
 81%|██████████████████████████████▋       | 2.28M/2.82M [00:09<00:02, 258kB/s]
 82%|███████████████████████████████▏      | 2.31M/2.82M [00:09<00:01, 258kB/s]
 83%|███████████████████████████████▌      | 2.34M/2.82M [00:09<00:01, 258kB/s]
 84%|████████████████████████████████      | 2.37M/2.82M [00:09<00:01, 258kB/s]
 86%|████████████████████████████████▍     | 2.41M/2.82M [00:09<00:01, 258kB/s]
 87%|████████████████████████████████▉     | 2.44M/2.82M [00:09<00:01, 259kB/s]
 88%|█████████████████████████████████▎    | 2.47M/2.82M [00:09<00:01, 258kB/s]
 89%|█████████████████████████████████▊    | 2.51M/2.82M [00:09<00:01, 258kB/s]
 90%|██████████████████████████████████▎   | 2.54M/2.82M [00:10<00:01, 258kB/s]
 91%|██████████████████████████████████▋   | 2.57M/2.82M [00:10<00:00, 258kB/s]
 92%|███████████████████████████████████▏  | 2.60M/2.82M [00:10<00:00, 258kB/s]
 94%|███████████████████████████████████▌  | 2.64M/2.82M [00:10<00:00, 258kB/s]
 95%|████████████████████████████████████  | 2.67M/2.82M [00:10<00:00, 258kB/s]
 96%|████████████████████████████████████▍ | 2.70M/2.82M [00:10<00:00, 258kB/s]
 97%|████████████████████████████████████▉ | 2.74M/2.82M [00:10<00:00, 258kB/s]
 98%|█████████████████████████████████████▎| 2.77M/2.82M [00:10<00:00, 258kB/s]
 99%|█████████████████████████████████████▊| 2.80M/2.82M [00:11<00:00, 259kB/s]
  0%|                                              | 0.00/2.82M [00:00<?, ?B/s]
100%|█████████████████████████████████████| 2.82M/2.82M [00:00<00:00, 3.67GB/s]

  0%|                                              | 0.00/2.58M [00:00<?, ?B/s]
  1%|▍                                     | 31.7k/2.58M [00:00<00:10, 244kB/s]
  3%|█▏                                    | 80.9k/2.58M [00:00<00:07, 321kB/s]
  4%|█▋                                     | 114k/2.58M [00:00<00:08, 288kB/s]
  6%|██▏                                    | 146k/2.58M [00:00<00:08, 273kB/s]
  7%|██▋                                    | 179k/2.58M [00:00<00:09, 264kB/s]
  8%|███▏                                   | 212k/2.58M [00:00<00:09, 259kB/s]
  9%|███▋                                   | 245k/2.58M [00:00<00:09, 256kB/s]
 11%|████▏                                  | 278k/2.58M [00:01<00:09, 254kB/s]
 12%|████▋                                  | 310k/2.58M [00:01<00:08, 253kB/s]
 13%|█████▏                                 | 343k/2.58M [00:01<00:08, 252kB/s]
 15%|█████▋                                 | 376k/2.58M [00:01<00:08, 251kB/s]
 16%|██████▏                                | 409k/2.58M [00:01<00:08, 251kB/s]
 17%|██████▋                                | 441k/2.58M [00:01<00:08, 251kB/s]
 18%|███████▏                               | 474k/2.58M [00:01<00:08, 250kB/s]
 20%|███████▋                               | 507k/2.58M [00:01<00:08, 250kB/s]
 21%|████████▏                              | 540k/2.58M [00:02<00:08, 250kB/s]
 22%|████████▋                              | 572k/2.58M [00:02<00:08, 250kB/s]
 23%|█████████▏                             | 605k/2.58M [00:02<00:07, 250kB/s]
 25%|█████████▋                             | 638k/2.58M [00:02<00:07, 250kB/s]
 26%|██████████                             | 671k/2.58M [00:02<00:07, 250kB/s]
 27%|██████████▌                            | 703k/2.58M [00:02<00:07, 250kB/s]
 28%|███████████                            | 736k/2.58M [00:02<00:07, 250kB/s]
 30%|███████████▌                           | 769k/2.58M [00:03<00:07, 250kB/s]
 31%|████████████                           | 802k/2.58M [00:03<00:07, 250kB/s]
 32%|████████████▌                          | 835k/2.58M [00:03<00:07, 250kB/s]
 34%|█████████████                          | 867k/2.58M [00:03<00:06, 250kB/s]
 35%|█████████████▌                         | 900k/2.58M [00:03<00:06, 250kB/s]
 36%|██████████████                         | 933k/2.58M [00:03<00:06, 246kB/s]
 37%|██████████████▌                        | 966k/2.58M [00:03<00:06, 247kB/s]
 39%|███████████████                        | 998k/2.58M [00:03<00:06, 248kB/s]
 40%|███████████████▏                      | 1.03M/2.58M [00:04<00:06, 248kB/s]
 41%|███████████████▋                      | 1.06M/2.58M [00:04<00:06, 249kB/s]
 42%|████████████████▏                     | 1.10M/2.58M [00:04<00:05, 249kB/s]
 44%|████████████████▌                     | 1.13M/2.58M [00:04<00:05, 249kB/s]
 45%|█████████████████                     | 1.16M/2.58M [00:04<00:05, 242kB/s]
 46%|█████████████████▌                    | 1.20M/2.58M [00:04<00:05, 245kB/s]
 48%|██████████████████                    | 1.23M/2.58M [00:04<00:05, 246kB/s]
 49%|██████████████████▌                   | 1.26M/2.58M [00:05<00:05, 247kB/s]
 50%|███████████████████                   | 1.29M/2.58M [00:05<00:05, 248kB/s]
 51%|███████████████████▌                  | 1.33M/2.58M [00:05<00:05, 248kB/s]
 53%|███████████████████▉                  | 1.36M/2.58M [00:05<00:04, 249kB/s]
 54%|████████████████████▍                 | 1.39M/2.58M [00:05<00:04, 249kB/s]
 55%|████████████████████▉                 | 1.42M/2.58M [00:05<00:04, 249kB/s]
 56%|█████████████████████▍                | 1.46M/2.58M [00:05<00:04, 249kB/s]
 58%|█████████████████████▉                | 1.49M/2.58M [00:05<00:04, 249kB/s]
 59%|██████████████████████▍               | 1.52M/2.58M [00:06<00:04, 249kB/s]
 60%|██████████████████████▊               | 1.56M/2.58M [00:06<00:04, 249kB/s]
 61%|███████████████████████▎              | 1.59M/2.58M [00:06<00:03, 249kB/s]
 63%|███████████████████████▊              | 1.62M/2.58M [00:06<00:03, 249kB/s]
 64%|████████████████████████▎             | 1.65M/2.58M [00:06<00:03, 250kB/s]
 65%|████████████████████████▊             | 1.69M/2.58M [00:06<00:03, 250kB/s]
 67%|█████████████████████████▌            | 1.74M/2.58M [00:06<00:02, 286kB/s]
 68%|██████████████████████████            | 1.77M/2.58M [00:06<00:02, 275kB/s]
 70%|██████████████████████████▍           | 1.80M/2.58M [00:07<00:02, 268kB/s]
 71%|██████████████████████████▉           | 1.83M/2.58M [00:07<00:02, 260kB/s]
 72%|███████████████████████████▍          | 1.87M/2.58M [00:07<00:02, 257kB/s]
 74%|███████████████████████████▉          | 1.90M/2.58M [00:07<00:02, 255kB/s]
 75%|████████████████████████████▍         | 1.93M/2.58M [00:07<00:02, 253kB/s]
 76%|████████████████████████████▉         | 1.97M/2.58M [00:07<00:02, 248kB/s]
 77%|█████████████████████████████▍        | 2.00M/2.58M [00:07<00:02, 248kB/s]
 79%|█████████████████████████████▊        | 2.03M/2.58M [00:08<00:02, 242kB/s]
 80%|██████████████████████████████▎       | 2.06M/2.58M [00:08<00:02, 245kB/s]
 81%|██████████████████████████████▊       | 2.10M/2.58M [00:08<00:01, 246kB/s]
 82%|███████████████████████████████▎      | 2.13M/2.58M [00:08<00:01, 247kB/s]
 84%|███████████████████████████████▊      | 2.16M/2.58M [00:08<00:01, 247kB/s]
 85%|████████████████████████████████▎     | 2.19M/2.58M [00:08<00:01, 246kB/s]
 86%|████████████████████████████████▊     | 2.23M/2.58M [00:08<00:01, 247kB/s]
 87%|█████████████████████████████████▏    | 2.26M/2.58M [00:08<00:01, 248kB/s]
 89%|█████████████████████████████████▋    | 2.29M/2.58M [00:09<00:01, 248kB/s]
 90%|██████████████████████████████████▏   | 2.33M/2.58M [00:09<00:01, 247kB/s]
 91%|██████████████████████████████████▋   | 2.36M/2.58M [00:09<00:00, 248kB/s]
 93%|███████████████████████████████████▏  | 2.39M/2.58M [00:09<00:00, 249kB/s]
 94%|███████████████████████████████████▋  | 2.42M/2.58M [00:09<00:00, 247kB/s]
 95%|████████████████████████████████████  | 2.46M/2.58M [00:09<00:00, 245kB/s]
 96%|████████████████████████████████████▌ | 2.49M/2.58M [00:09<00:00, 240kB/s]
 98%|█████████████████████████████████████ | 2.52M/2.58M [00:10<00:00, 240kB/s]
 99%|█████████████████████████████████████▌| 2.55M/2.58M [00:10<00:00, 243kB/s]
  0%|                                              | 0.00/2.58M [00:00<?, ?B/s]
100%|█████████████████████████████████████| 2.58M/2.58M [00:00<00:00, 3.54GB/s]

  0%|                                              | 0.00/2.14M [00:00<?, ?B/s]
  1%|▌                                     | 31.7k/2.14M [00:00<00:08, 251kB/s]
  4%|█▍                                    | 80.9k/2.14M [00:00<00:06, 331kB/s]
  5%|██                                     | 115k/2.14M [00:00<00:06, 302kB/s]
  7%|██▋                                    | 146k/2.14M [00:00<00:07, 281kB/s]
  8%|███▎                                   | 179k/2.14M [00:00<00:07, 273kB/s]
 10%|███▊                                   | 212k/2.14M [00:00<00:07, 268kB/s]
 11%|████▍                                  | 245k/2.14M [00:00<00:07, 265kB/s]
 13%|█████                                  | 278k/2.14M [00:01<00:07, 263kB/s]
 14%|█████▋                                 | 310k/2.14M [00:01<00:07, 261kB/s]
 16%|██████▏                                | 343k/2.14M [00:01<00:06, 259kB/s]
 18%|██████▊                                | 376k/2.14M [00:01<00:06, 259kB/s]
 19%|███████▍                               | 409k/2.14M [00:01<00:06, 259kB/s]
 21%|████████                               | 441k/2.14M [00:01<00:06, 259kB/s]
 22%|████████▋                              | 474k/2.14M [00:01<00:06, 258kB/s]
 24%|█████████▏                             | 507k/2.14M [00:01<00:06, 258kB/s]
 25%|█████████▊                             | 540k/2.14M [00:02<00:06, 258kB/s]
 27%|██████████▍                            | 572k/2.14M [00:02<00:06, 258kB/s]
 28%|███████████                            | 605k/2.14M [00:02<00:05, 258kB/s]
 30%|███████████▌                           | 638k/2.14M [00:02<00:05, 258kB/s]
 31%|████████████▏                          | 671k/2.14M [00:02<00:05, 258kB/s]
 33%|████████████▊                          | 703k/2.14M [00:02<00:05, 259kB/s]
 34%|█████████████▍                         | 736k/2.14M [00:02<00:05, 259kB/s]
 36%|█████████████▉                         | 769k/2.14M [00:02<00:05, 258kB/s]
 37%|██████████████▌                        | 802k/2.14M [00:03<00:05, 258kB/s]
 39%|███████████████▏                       | 835k/2.14M [00:03<00:05, 259kB/s]
 40%|███████████████▊                       | 867k/2.14M [00:03<00:04, 258kB/s]
 42%|████████████████▍                      | 900k/2.14M [00:03<00:04, 258kB/s]
 44%|████████████████▉                      | 933k/2.14M [00:03<00:04, 258kB/s]
 45%|█████████████████▌                     | 966k/2.14M [00:03<00:04, 258kB/s]
 47%|██████████████████▏                    | 998k/2.14M [00:03<00:04, 258kB/s]
 48%|██████████████████▎                   | 1.03M/2.14M [00:03<00:04, 259kB/s]
 50%|██████████████████▊                   | 1.06M/2.14M [00:04<00:04, 259kB/s]
 51%|███████████████████▍                  | 1.10M/2.14M [00:04<00:04, 259kB/s]
 53%|████████████████████                  | 1.13M/2.14M [00:04<00:03, 258kB/s]
 54%|████████████████████▌                 | 1.16M/2.14M [00:04<00:03, 259kB/s]
 56%|█████████████████████▏                | 1.20M/2.14M [00:04<00:03, 258kB/s]
 57%|█████████████████████▊                | 1.23M/2.14M [00:04<00:03, 258kB/s]
 59%|██████████████████████▎               | 1.26M/2.14M [00:04<00:03, 258kB/s]
 60%|██████████████████████▉               | 1.29M/2.14M [00:04<00:03, 258kB/s]
 62%|███████████████████████▌              | 1.33M/2.14M [00:05<00:03, 258kB/s]
 63%|████████████████████████              | 1.36M/2.14M [00:05<00:03, 258kB/s]
 65%|████████████████████████▋             | 1.39M/2.14M [00:05<00:02, 258kB/s]
 66%|█████████████████████████▎            | 1.42M/2.14M [00:05<00:02, 258kB/s]
 68%|█████████████████████████▊            | 1.46M/2.14M [00:05<00:02, 259kB/s]
 70%|██████████████████████████▍           | 1.49M/2.14M [00:05<00:02, 258kB/s]
 71%|███████████████████████████           | 1.52M/2.14M [00:05<00:02, 258kB/s]
 73%|███████████████████████████▌          | 1.56M/2.14M [00:05<00:02, 258kB/s]
 74%|████████████████████████████▏         | 1.59M/2.14M [00:06<00:02, 258kB/s]
 76%|████████████████████████████▋         | 1.62M/2.14M [00:06<00:02, 258kB/s]
 77%|█████████████████████████████▎        | 1.65M/2.14M [00:06<00:01, 259kB/s]
 79%|█████████████████████████████▉        | 1.69M/2.14M [00:06<00:01, 259kB/s]
 80%|██████████████████████████████▍       | 1.72M/2.14M [00:06<00:01, 259kB/s]
 82%|███████████████████████████████       | 1.75M/2.14M [00:06<00:01, 259kB/s]
 83%|███████████████████████████████▋      | 1.78M/2.14M [00:06<00:01, 258kB/s]
 85%|████████████████████████████████▏     | 1.82M/2.14M [00:06<00:01, 258kB/s]
 86%|████████████████████████████████▊     | 1.85M/2.14M [00:07<00:01, 258kB/s]
 88%|█████████████████████████████████▍    | 1.88M/2.14M [00:07<00:01, 258kB/s]
 89%|█████████████████████████████████▉    | 1.92M/2.14M [00:07<00:00, 258kB/s]
 91%|██████████████████████████████████▌   | 1.95M/2.14M [00:07<00:00, 258kB/s]
 92%|███████████████████████████████████▏  | 1.98M/2.14M [00:07<00:00, 258kB/s]
 94%|███████████████████████████████████▋  | 2.01M/2.14M [00:07<00:00, 258kB/s]
 96%|████████████████████████████████████▎ | 2.05M/2.14M [00:07<00:00, 258kB/s]
 97%|████████████████████████████████████▉ | 2.08M/2.14M [00:07<00:00, 258kB/s]
 99%|█████████████████████████████████████▍| 2.11M/2.14M [00:08<00:00, 258kB/s]
  0%|                                              | 0.00/2.14M [00:00<?, ?B/s]
100%|█████████████████████████████████████| 2.14M/2.14M [00:00<00:00, 2.62GB/s]

SSVEP Exoskeleton-CrossSubject:   0%|          | 0/2 [00:00<?, ?it/s]
SSVEP Exoskeleton-CrossSubject:  50%|#####     | 1/2 [00:00<00:00,  3.76it/s]
SSVEP Exoskeleton-CrossSubject: 100%|##########| 2/2 [00:00<00:00,  3.80it/s]
SSVEP Exoskeleton-CrossSubject: 100%|##########| 2/2 [00:00<00:00,  3.79it/s]

Filter bank processing, determine the filter automatically from the stimulation frequency values of events.

evaluation_fb = CrossSubjectEvaluation(
    paradigm=paradigm_fb, datasets=dataset, overwrite=overwrite
)
results_fb = evaluation_fb.process(pipelines_fb)

Out:

SSVEP Exoskeleton-CrossSubject:   0%|          | 0/2 [00:00<?, ?it/s]
SSVEP Exoskeleton-CrossSubject:  50%|#####     | 1/2 [00:00<00:00,  4.71it/s]
SSVEP Exoskeleton-CrossSubject: 100%|##########| 2/2 [00:00<00:00,  4.59it/s]
SSVEP Exoskeleton-CrossSubject: 100%|##########| 2/2 [00:00<00:00,  4.60it/s]

TRCA processing also relies on filter bank that is automatically designed.

evaluation_TRCA = CrossSubjectEvaluation(
    paradigm=paradigm_TRCA, datasets=dataset, overwrite=overwrite
)
results_TRCA = evaluation_TRCA.process(pipelines_TRCA)

Out:

SSVEP Exoskeleton-CrossSubject:   0%|          | 0/2 [00:00<?, ?it/s]
SSVEP Exoskeleton-CrossSubject:  50%|#####     | 1/2 [00:01<00:01,  1.13s/it]
SSVEP Exoskeleton-CrossSubject: 100%|##########| 2/2 [00:02<00:00,  1.09s/it]
SSVEP Exoskeleton-CrossSubject: 100%|##########| 2/2 [00:02<00:00,  1.10s/it]

After processing the three, we simply concatenate the results.

results = pd.concat([results, results_fb, results_TRCA])

Plot Results

Here we display the results as stripplot, with a pointplot for error bar.

fig, ax = plt.subplots(facecolor="white", figsize=[8, 4])
sns.stripplot(
    data=results,
    y="score",
    x="pipeline",
    ax=ax,
    jitter=True,
    alpha=0.5,
    zorder=1,
    palette="Set1",
)
sns.pointplot(data=results, y="score", x="pipeline", ax=ax, zorder=1, palette="Set1")
ax.set_ylabel("Accuracy")
ax.set_ylim(0.1, 0.6)
fig.show()
plot cross subject ssvep

Total running time of the script: ( 0 minutes 48.057 seconds)

Gallery generated by Sphinx-Gallery