Cross-Subject SSVEP#

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

  • Riemannian Geometry

  • CCA

  • TRCA

  • MsetCCA

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 Kalunga2016
from moabb.evaluations import CrossSubjectEvaluation
from moabb.paradigms import SSVEP, FilterBankSSVEP
from moabb.pipelines import SSVEP_CCA, SSVEP_TRCA, ExtendedSSVEPSignal, SSVEP_MsetCCA


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

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, SSVEP TRCA, SSVEP MsetCCA, and FilterBankSSVEP) and use the dataset Kalunga2016. All 3 SSVEP paradigms applied a bandpass filter (10-42 Hz) on the data, which include all stimuli frequencies and their first harmonics, while the FilterBankSSVEP paradigm uses as many bandpass filters as there are stimulation frequencies (here 3). 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=42, n_classes=3)
paradigm_TRCA = SSVEP(fmin=10, fmax=42, n_classes=3)
paradigm_MSET_CCA = SSVEP(fmin=10, fmax=42, 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

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, and the fourth uses the MsetCCA algorithm. Both CCA based methods (i.e. CCA and MsetCCA) used 3 CCA components.

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)
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py:1064: InsecureRequestWarning: Unverified HTTPS request is being made to host 'zenodo.org'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
  warnings.warn(
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py:1064: InsecureRequestWarning: Unverified HTTPS request is being made to host 'zenodo.org'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
  warnings.warn(

  0%|                                              | 0.00/2.06M [00:00<?, ?B/s]
  1%|▏                                    | 12.3k/2.06M [00:00<00:22, 90.8kB/s]
  2%|▋                                     | 39.9k/2.06M [00:00<00:11, 175kB/s]
  5%|█▉                                     | 102k/2.06M [00:00<00:05, 342kB/s]
 11%|████▏                                  | 222k/2.06M [00:00<00:02, 617kB/s]
 14%|█████▌                                 | 293k/2.06M [00:00<00:02, 621kB/s]
 18%|███████                                | 374k/2.06M [00:00<00:02, 652kB/s]
 21%|████████▎                              | 441k/2.06M [00:00<00:02, 634kB/s]
 25%|█████████▉                             | 523k/2.06M [00:00<00:02, 664kB/s]
 29%|███████████▍                           | 605k/2.06M [00:01<00:02, 683kB/s]
 33%|████████████▊                          | 674k/2.06M [00:01<00:02, 661kB/s]
 37%|██████████████▎                        | 753k/2.06M [00:01<00:01, 674kB/s]
 40%|███████████████▌                       | 820k/2.06M [00:01<00:01, 650kB/s]
 44%|█████████████████                      | 900k/2.06M [00:01<00:01, 670kB/s]
 49%|██████████████████▉                    | 997k/2.06M [00:01<00:01, 730kB/s]
 53%|███████████████████▉                  | 1.08M/2.06M [00:01<00:01, 728kB/s]
 56%|█████████████████████▎                | 1.15M/2.06M [00:01<00:01, 705kB/s]
 60%|██████████████████████▉               | 1.24M/2.06M [00:01<00:01, 730kB/s]
 67%|█████████████████████████▍            | 1.37M/2.06M [00:02<00:00, 852kB/s]
 71%|██████████████████████████▉           | 1.46M/2.06M [00:02<00:00, 822kB/s]
 75%|████████████████████████████▌         | 1.54M/2.06M [00:02<00:00, 796kB/s]
 79%|█████████████████████████████▉        | 1.62M/2.06M [00:02<00:00, 770kB/s]
 83%|███████████████████████████████▍      | 1.70M/2.06M [00:02<00:00, 749kB/s]
 87%|████████████████████████████████▉     | 1.78M/2.06M [00:02<00:00, 742kB/s]
 92%|██████████████████████████████████▊   | 1.88M/2.06M [00:02<00:00, 780kB/s]
 98%|█████████████████████████████████████▏| 2.01M/2.06M [00:02<00:00, 891kB/s]
  0%|                                              | 0.00/2.06M [00:00<?, ?B/s]
100%|█████████████████████████████████████| 2.06M/2.06M [00:00<00:00, 10.7GB/s]
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py:1064: InsecureRequestWarning: Unverified HTTPS request is being made to host 'zenodo.org'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
  warnings.warn(
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py:1064: InsecureRequestWarning: Unverified HTTPS request is being made to host 'zenodo.org'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
  warnings.warn(

  0%|                                              | 0.00/2.82M [00:00<?, ?B/s]
  0%|▏                                    | 12.3k/2.82M [00:00<00:32, 87.2kB/s]
  2%|▋                                     | 48.1k/2.82M [00:00<00:13, 211kB/s]
  4%|█▌                                     | 109k/2.82M [00:00<00:07, 353kB/s]
  5%|██                                     | 151k/2.82M [00:00<00:07, 361kB/s]
  8%|███                                    | 217k/2.82M [00:00<00:05, 443kB/s]
 11%|████                                   | 296k/2.82M [00:00<00:04, 530kB/s]
 13%|█████                                  | 369k/2.82M [00:00<00:04, 568kB/s]
 16%|██████▏                                | 451k/2.82M [00:00<00:03, 619kB/s]
 19%|███████▍                               | 532k/2.82M [00:01<00:03, 653kB/s]
 22%|████████▌                              | 614k/2.82M [00:01<00:03, 675kB/s]
 25%|█████████▋                             | 696k/2.82M [00:01<00:03, 691kB/s]
 30%|███████████▋                           | 844k/2.82M [00:01<00:02, 878kB/s]
 33%|████████████▉                          | 932k/2.82M [00:01<00:02, 849kB/s]
 36%|█████████████▊                        | 1.02M/2.82M [00:01<00:02, 838kB/s]
 39%|██████████████▉                       | 1.11M/2.82M [00:01<00:02, 810kB/s]
 43%|████████████████▏                     | 1.20M/2.82M [00:01<00:01, 823kB/s]
 46%|█████████████████▌                    | 1.30M/2.82M [00:01<00:01, 838kB/s]
 50%|██████████████████▉                   | 1.40M/2.82M [00:02<00:01, 848kB/s]
 53%|████████████████████                  | 1.48M/2.82M [00:02<00:01, 819kB/s]
 56%|█████████████████████▏                | 1.57M/2.82M [00:02<00:01, 790kB/s]
 61%|███████████████████████               | 1.71M/2.82M [00:02<00:01, 925kB/s]
 64%|████████████████████████▎             | 1.80M/2.82M [00:02<00:01, 893kB/s]
 68%|█████████████████████████▉            | 1.92M/2.82M [00:02<00:00, 943kB/s]
 72%|███████████████████████████▏          | 2.02M/2.82M [00:02<00:00, 912kB/s]
 76%|█████████████████████████████         | 2.15M/2.82M [00:02<00:00, 993kB/s]
 80%|██████████████████████████████▍       | 2.25M/2.82M [00:02<00:00, 958kB/s]
 83%|███████████████████████████████▋      | 2.35M/2.82M [00:03<00:00, 926kB/s]
 87%|████████████████████████████████▉     | 2.44M/2.82M [00:03<00:00, 895kB/s]
 90%|██████████████████████████████████▏   | 2.53M/2.82M [00:03<00:00, 865kB/s]
 93%|███████████████████████████████████▎  | 2.62M/2.82M [00:03<00:00, 837kB/s]
 96%|████████████████████████████████████▍ | 2.70M/2.82M [00:03<00:00, 810kB/s]
 99%|█████████████████████████████████████▌| 2.78M/2.82M [00:03<00:00, 784kB/s]
  0%|                                              | 0.00/2.82M [00:00<?, ?B/s]
100%|█████████████████████████████████████| 2.82M/2.82M [00:00<00:00, 15.1GB/s]
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py:1064: InsecureRequestWarning: Unverified HTTPS request is being made to host 'zenodo.org'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
  warnings.warn(
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py:1064: InsecureRequestWarning: Unverified HTTPS request is being made to host 'zenodo.org'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
  warnings.warn(

  0%|                                              | 0.00/2.58M [00:00<?, ?B/s]
  0%|▏                                    | 12.3k/2.58M [00:00<00:27, 93.2kB/s]
  2%|▋                                     | 45.1k/2.58M [00:00<00:12, 202kB/s]
  4%|█▋                                     | 109k/2.58M [00:00<00:06, 362kB/s]
  7%|██▉                                    | 193k/2.58M [00:00<00:04, 509kB/s]
 11%|████▏                                  | 279k/2.58M [00:00<00:03, 600kB/s]
 14%|█████▎                                 | 354k/2.58M [00:00<00:03, 623kB/s]
 19%|███████▍                               | 492k/2.58M [00:00<00:02, 805kB/s]
 22%|████████▋                              | 572k/2.58M [00:00<00:02, 777kB/s]
 25%|█████████▊                             | 650k/2.58M [00:01<00:02, 750kB/s]
 28%|██████████▉                            | 726k/2.58M [00:01<00:02, 724kB/s]
 31%|████████████                           | 802k/2.58M [00:01<00:02, 708kB/s]
 34%|█████████████▏                         | 873k/2.58M [00:01<00:02, 686kB/s]
 37%|██████████████▎                        | 949k/2.58M [00:01<00:02, 681kB/s]
 40%|███████████████▏                      | 1.03M/2.58M [00:01<00:02, 693kB/s]
 45%|█████████████████                     | 1.16M/2.58M [00:01<00:01, 828kB/s]
 49%|██████████████████▌                   | 1.26M/2.58M [00:01<00:01, 841kB/s]
 52%|███████████████████▊                  | 1.34M/2.58M [00:01<00:01, 814kB/s]
 55%|████████████████████▉                 | 1.43M/2.58M [00:02<00:01, 786kB/s]
 59%|██████████████████████▍               | 1.52M/2.58M [00:02<00:01, 803kB/s]
 62%|███████████████████████▌              | 1.60M/2.58M [00:02<00:01, 776kB/s]
 65%|████████████████████████▋             | 1.68M/2.58M [00:02<00:01, 750kB/s]
 68%|█████████████████████████▊            | 1.76M/2.58M [00:02<00:01, 723kB/s]
 71%|██████████████████████████▉           | 1.83M/2.58M [00:02<00:01, 699kB/s]
 74%|████████████████████████████▏         | 1.91M/2.58M [00:02<00:00, 716kB/s]
 77%|█████████████████████████████▎        | 2.00M/2.58M [00:02<00:00, 719kB/s]
 81%|██████████████████████████████▊       | 2.09M/2.58M [00:02<00:00, 765kB/s]
 84%|███████████████████████████████▉      | 2.17M/2.58M [00:03<00:00, 749kB/s]
 89%|█████████████████████████████████▉    | 2.31M/2.58M [00:03<00:00, 865kB/s]
 93%|███████████████████████████████████▏  | 2.39M/2.58M [00:03<00:00, 836kB/s]
 96%|████████████████████████████████████▍ | 2.48M/2.58M [00:03<00:00, 808kB/s]
  0%|                                              | 0.00/2.58M [00:00<?, ?B/s]
100%|█████████████████████████████████████| 2.58M/2.58M [00:00<00:00, 13.5GB/s]
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py:1064: InsecureRequestWarning: Unverified HTTPS request is being made to host 'zenodo.org'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
  warnings.warn(
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py:1064: InsecureRequestWarning: Unverified HTTPS request is being made to host 'zenodo.org'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
  warnings.warn(

  0%|                                              | 0.00/2.14M [00:00<?, ?B/s]
  1%|▎                                     | 15.4k/2.14M [00:00<00:19, 111kB/s]
  2%|▊                                     | 48.1k/2.14M [00:00<00:10, 208kB/s]
  5%|█▊                                     | 101k/2.14M [00:00<00:06, 323kB/s]
  9%|███▎                                   | 184k/2.14M [00:00<00:04, 481kB/s]
 15%|█████▊                                 | 323k/2.14M [00:00<00:02, 742kB/s]
 19%|███████▏                               | 398k/2.14M [00:00<00:02, 718kB/s]
 22%|████████▋                              | 478k/2.14M [00:00<00:02, 715kB/s]
 26%|██████████▏                            | 560k/2.14M [00:00<00:02, 719kB/s]
 31%|████████████▎                          | 675k/2.14M [00:01<00:01, 812kB/s]
 36%|██████████████                         | 773k/2.14M [00:01<00:01, 829kB/s]
 40%|███████████████▌                       | 857k/2.14M [00:01<00:01, 803kB/s]
 47%|█████████████████▊                    | 1.00M/2.14M [00:01<00:01, 946kB/s]
 51%|███████████████████▍                  | 1.10M/2.14M [00:01<00:01, 914kB/s]
 55%|█████████████████████                 | 1.19M/2.14M [00:01<00:01, 883kB/s]
 60%|██████████████████████▋               | 1.28M/2.14M [00:01<00:01, 855kB/s]
 64%|████████████████████████▏             | 1.36M/2.14M [00:01<00:00, 826kB/s]
 68%|█████████████████████████▋            | 1.45M/2.14M [00:01<00:00, 798kB/s]
 71%|███████████████████████████           | 1.53M/2.14M [00:02<00:00, 772kB/s]
 75%|████████████████████████████▍         | 1.61M/2.14M [00:02<00:00, 752kB/s]
 80%|██████████████████████████████▏       | 1.70M/2.14M [00:02<00:00, 786kB/s]
 83%|███████████████████████████████▋      | 1.79M/2.14M [00:02<00:00, 767kB/s]
 87%|█████████████████████████████████▏    | 1.87M/2.14M [00:02<00:00, 753kB/s]
 91%|██████████████████████████████████▍   | 1.94M/2.14M [00:02<00:00, 725kB/s]
 94%|███████████████████████████████████▊  | 2.02M/2.14M [00:02<00:00, 701kB/s]
 97%|█████████████████████████████████████ | 2.09M/2.14M [00:02<00:00, 679kB/s]
  0%|                                              | 0.00/2.14M [00:00<?, ?B/s]
100%|█████████████████████████████████████| 2.14M/2.14M [00:00<00:00, 12.9GB/s]
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")

Kalunga2016-CrossSubject:   0%|          | 0/2 [00:00<?, ?it/s]
Kalunga2016-CrossSubject:  50%|#####     | 1/2 [00:00<00:00,  2.06it/s]
Kalunga2016-CrossSubject: 100%|##########| 2/2 [00:00<00:00,  2.06it/s]
Kalunga2016-CrossSubject: 100%|##########| 2/2 [00:00<00:00,  2.06it/s]

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

/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")

Kalunga2016-CrossSubject:   0%|          | 0/2 [00:00<?, ?it/s]
Kalunga2016-CrossSubject:  50%|#####     | 1/2 [00:00<00:00,  2.75it/s]
Kalunga2016-CrossSubject: 100%|##########| 2/2 [00:00<00:00,  2.74it/s]
Kalunga2016-CrossSubject: 100%|##########| 2/2 [00:00<00:00,  2.74it/s]

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

/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")

Kalunga2016-CrossSubject:   0%|          | 0/2 [00:00<?, ?it/s]
Kalunga2016-CrossSubject:  50%|#####     | 1/2 [00:00<00:00,  1.33it/s]
Kalunga2016-CrossSubject: 100%|##########| 2/2 [00:01<00:00,  1.37it/s]
Kalunga2016-CrossSubject: 100%|##########| 2/2 [00:01<00:00,  1.36it/s]

MsetCCA processing

/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: UserWarning: warnEpochs <Epochs | 24 events (all good), 2 – 4 s (baseline off), ~785 kB, data loaded,
 '13': 8
 '17': 8
 '21': 8>
  warn(f"warnEpochs {epochs}")

Kalunga2016-CrossSubject:   0%|          | 0/2 [00:00<?, ?it/s]
Kalunga2016-CrossSubject:  50%|#####     | 1/2 [00:00<00:00,  1.53it/s]
Kalunga2016-CrossSubject: 100%|##########| 2/2 [00:01<00:00,  1.60it/s]
Kalunga2016-CrossSubject: 100%|##########| 2/2 [00:01<00:00,  1.59it/s]

After processing the four, we simply concatenate the results.

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

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, palette="Set1")
ax.set_ylabel("Accuracy")
ax.set_ylim(0.1, 0.6)
plt.show()
plot cross subject ssvep

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

Estimated memory usage: 10 MB

Gallery generated by Sphinx-Gallery