Statistical Analysis#

The MOABB codebase comes with convenience plotting utilities and some statistical testing. This tutorial focuses on what those exactly are and how they can be used.

# Authors: Vinay Jayaram <vinayjayaram13@gmail.com>
#
# License: BSD (3-clause)
# sphinx_gallery_thumbnail_number = -2

import matplotlib.pyplot as plt
from mne.decoding import CSP
from pyriemann.estimation import Covariances
from pyriemann.tangentspace import TangentSpace
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import make_pipeline

import moabb
import moabb.analysis.plotting as moabb_plt
from moabb.analysis.meta_analysis import (  # noqa: E501
    compute_dataset_statistics,
    find_significant_differences,
)
from moabb.datasets import BNCI2014_001
from moabb.evaluations import CrossSessionEvaluation
from moabb.paradigms import LeftRightImagery


moabb.set_log_level("info")

print(__doc__)

Results Generation#

First we need to set up a paradigm, dataset list, and some pipelines to test. This is explored more in the examples – we choose left vs right imagery paradigm with a single bandpass. There is only one dataset here but any number can be added without changing this workflow.

Create Pipelines#

Pipelines must be a dict of sklearn pipeline transformer.

The CSP implementation from MNE is used. We selected 8 CSP components, as usually done in the literature.

The Riemannian geometry pipeline consists in covariance estimation, tangent space mapping and finally a logistic regression for the classification.

pipelines = {}

pipelines["CSP+LDA"] = make_pipeline(CSP(n_components=8), LDA())

pipelines["RG+LR"] = make_pipeline(Covariances(), TangentSpace(), LogisticRegression())

pipelines["CSP+LR"] = make_pipeline(CSP(n_components=8), LogisticRegression())

pipelines["RG+LDA"] = make_pipeline(Covariances(), TangentSpace(), LDA())

Evaluation#

We define the paradigm (LeftRightImagery) and the dataset (BNCI2014_001). The evaluation will return a DataFrame containing a single AUC 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.

BNCI2014-001-CrossSession:   0%|          | 0/4 [00:00<?, ?it/s]/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")

BNCI2014-001-CrossSession:  25%|##5       | 1/4 [00:06<00:19,  6.35s/it]/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")

BNCI2014-001-CrossSession:  50%|#####     | 2/4 [00:12<00:12,  6.06s/it]/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lampx.tugraz.at'. 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/44.1M [00:00<?, ?B/s]

  0%|                                     | 8.19k/44.1M [00:00<10:31, 69.7kB/s]

  0%|                                      | 32.8k/44.1M [00:00<04:52, 151kB/s]

  0%|                                      | 88.1k/44.1M [00:00<02:29, 294kB/s]

  0%|▏                                      | 193k/44.1M [00:00<01:23, 525kB/s]

  1%|▎                                      | 409k/44.1M [00:00<00:44, 992kB/s]

  2%|▋                                     | 841k/44.1M [00:00<00:22, 1.89MB/s]

  4%|█▍                                   | 1.71M/44.1M [00:00<00:11, 3.67MB/s]

  8%|██▉                                  | 3.44M/44.1M [00:00<00:05, 7.13MB/s]

 15%|█████▍                               | 6.53M/44.1M [00:01<00:02, 13.0MB/s]

 21%|███████▊                             | 9.34M/44.1M [00:01<00:02, 16.3MB/s]

 27%|█████████▉                           | 11.8M/44.1M [00:01<00:01, 17.7MB/s]

 33%|████████████▏                        | 14.6M/44.1M [00:01<00:01, 19.4MB/s]

 40%|██████████████▋                      | 17.5M/44.1M [00:01<00:01, 21.0MB/s]

 46%|████████████████▉                    | 20.2M/44.1M [00:01<00:01, 21.5MB/s]

 52%|███████████████████▏                 | 22.9M/44.1M [00:01<00:00, 21.8MB/s]

 59%|█████████████████████▋               | 25.8M/44.1M [00:01<00:00, 22.7MB/s]

 65%|████████████████████████             | 28.6M/44.1M [00:02<00:00, 23.0MB/s]

 71%|██████████████████████████▏          | 31.2M/44.1M [00:02<00:00, 22.7MB/s]

 78%|████████████████████████████▋        | 34.2M/44.1M [00:02<00:00, 23.3MB/s]

 85%|███████████████████████████████▎     | 37.3M/44.1M [00:02<00:00, 24.2MB/s]

 91%|█████████████████████████████████▊   | 40.3M/44.1M [00:02<00:00, 24.5MB/s]

 98%|████████████████████████████████████▏| 43.1M/44.1M [00:02<00:00, 24.2MB/s]

  0%|                                              | 0.00/44.1M [00:00<?, ?B/s]
100%|██████████████████████████████████████| 44.1M/44.1M [00:00<00:00, 183GB/s]
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lampx.tugraz.at'. 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/42.3M [00:00<?, ?B/s]

  0%|                                     | 8.19k/42.3M [00:00<10:07, 69.6kB/s]

  0%|                                      | 32.8k/42.3M [00:00<04:40, 151kB/s]

  0%|                                      | 96.3k/42.3M [00:00<02:09, 326kB/s]

  0%|▏                                      | 209k/42.3M [00:00<01:13, 572kB/s]

  1%|▍                                     | 432k/42.3M [00:00<00:40, 1.04MB/s]

  2%|▊                                     | 889k/42.3M [00:00<00:20, 1.99MB/s]

  4%|█▌                                   | 1.80M/42.3M [00:00<00:10, 3.86MB/s]

  9%|███▏                                 | 3.62M/42.3M [00:00<00:05, 7.52MB/s]

 16%|█████▉                               | 6.74M/42.3M [00:01<00:02, 13.4MB/s]

 22%|████████▏                            | 9.42M/42.3M [00:01<00:02, 16.2MB/s]

 30%|██████████▉                          | 12.5M/42.3M [00:01<00:01, 19.3MB/s]

 36%|█████████████▎                       | 15.3M/42.3M [00:01<00:01, 20.3MB/s]

 43%|███████████████▊                     | 18.1M/42.3M [00:01<00:01, 21.3MB/s]

 50%|██████████████████▍                  | 21.0M/42.3M [00:01<00:00, 22.2MB/s]

 57%|█████████████████████                | 24.1M/42.3M [00:01<00:00, 23.2MB/s]

 64%|███████████████████████▋             | 27.2M/42.3M [00:01<00:00, 24.1MB/s]

 71%|██████████████████████████▏          | 30.0M/42.3M [00:02<00:00, 24.0MB/s]

 78%|████████████████████████████▊        | 32.9M/42.3M [00:02<00:00, 24.3MB/s]

 85%|███████████████████████████████▎     | 35.8M/42.3M [00:02<00:00, 24.3MB/s]

 92%|██████████████████████████████████   | 39.0M/42.3M [00:02<00:00, 24.9MB/s]

 99%|████████████████████████████████████▌| 41.8M/42.3M [00:02<00:00, 24.5MB/s]

  0%|                                              | 0.00/42.3M [00:00<?, ?B/s]
100%|██████████████████████████████████████| 42.3M/42.3M [00:00<00:00, 191GB/s]
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")

BNCI2014-001-CrossSession:  75%|#######5  | 3/4 [00:24<00:08,  8.87s/it]/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lampx.tugraz.at'. 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/37.2M [00:00<?, ?B/s]

  0%|                                     | 8.19k/37.2M [00:00<08:52, 69.7kB/s]

  0%|                                      | 32.8k/37.2M [00:00<04:06, 151kB/s]

  0%|                                      | 96.3k/37.2M [00:00<01:53, 326kB/s]

  1%|▏                                      | 209k/37.2M [00:00<01:04, 572kB/s]

  1%|▍                                     | 432k/37.2M [00:00<00:35, 1.04MB/s]

  2%|▉                                     | 889k/37.2M [00:00<00:18, 1.99MB/s]

  5%|█▊                                   | 1.80M/37.2M [00:00<00:09, 3.85MB/s]

 10%|███▌                                 | 3.62M/37.2M [00:00<00:04, 7.51MB/s]

 18%|██████▌                              | 6.59M/37.2M [00:01<00:02, 12.8MB/s]

 25%|█████████▍                           | 9.46M/37.2M [00:01<00:01, 16.3MB/s]

 32%|███████████▉                         | 12.0M/37.2M [00:01<00:01, 17.9MB/s]

 40%|██████████████▋                      | 14.7M/37.2M [00:01<00:01, 19.3MB/s]

 47%|█████████████████▍                   | 17.5M/37.2M [00:01<00:00, 20.6MB/s]

 54%|████████████████████                 | 20.1M/37.2M [00:01<00:00, 21.0MB/s]

 61%|██████████████████████▋              | 22.8M/37.2M [00:01<00:00, 21.6MB/s]

 69%|█████████████████████████▌           | 25.6M/37.2M [00:01<00:00, 22.1MB/s]

 76%|████████████████████████████▎        | 28.4M/37.2M [00:02<00:00, 22.5MB/s]

 84%|██████████████████████████████▉      | 31.1M/37.2M [00:02<00:00, 22.6MB/s]

 91%|█████████████████████████████████▋   | 33.8M/37.2M [00:02<00:00, 22.7MB/s]

 99%|████████████████████████████████████▍| 36.6M/37.2M [00:02<00:00, 22.9MB/s]

  0%|                                              | 0.00/37.2M [00:00<?, ?B/s]
100%|██████████████████████████████████████| 37.2M/37.2M [00:00<00:00, 148GB/s]
/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lampx.tugraz.at'. 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/41.7M [00:00<?, ?B/s]

  0%|                                     | 8.19k/41.7M [00:00<09:56, 69.9kB/s]

  0%|                                      | 32.8k/41.7M [00:00<04:36, 151kB/s]

  0%|                                      | 96.3k/41.7M [00:00<02:07, 326kB/s]

  1%|▏                                      | 209k/41.7M [00:00<01:12, 572kB/s]

  1%|▍                                     | 432k/41.7M [00:00<00:39, 1.04MB/s]

  2%|▊                                     | 889k/41.7M [00:00<00:20, 2.00MB/s]

  4%|█▌                                   | 1.80M/41.7M [00:00<00:10, 3.85MB/s]

  9%|███▏                                 | 3.62M/41.7M [00:00<00:05, 7.51MB/s]

 16%|█████▉                               | 6.68M/41.7M [00:01<00:02, 13.2MB/s]

 23%|████████▍                            | 9.50M/41.7M [00:01<00:01, 16.4MB/s]

 30%|██████████▉                          | 12.3M/41.7M [00:01<00:01, 18.6MB/s]

 36%|█████████████▍                       | 15.2M/41.7M [00:01<00:01, 20.2MB/s]

 43%|████████████████                     | 18.1M/41.7M [00:01<00:01, 21.5MB/s]

 50%|██████████████████▌                  | 20.9M/41.7M [00:01<00:00, 22.3MB/s]

 57%|█████████████████████                | 23.7M/41.7M [00:01<00:00, 22.6MB/s]

 64%|███████████████████████▌             | 26.6M/41.7M [00:01<00:00, 23.0MB/s]

 71%|██████████████████████████▎          | 29.6M/41.7M [00:02<00:00, 23.9MB/s]

 78%|█████████████████████████████        | 32.7M/41.7M [00:02<00:00, 24.5MB/s]

 85%|███████████████████████████████▍     | 35.5M/41.7M [00:02<00:00, 24.2MB/s]

 92%|██████████████████████████████████   | 38.4M/41.7M [00:02<00:00, 24.3MB/s]

 99%|████████████████████████████████████▊| 41.5M/41.7M [00:02<00:00, 24.7MB/s]

  0%|                                              | 0.00/41.7M [00:00<?, ?B/s]
100%|██████████████████████████████████████| 41.7M/41.7M [00:00<00:00, 189GB/s]
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:273: UserWarning: warnEpochs <Epochs |  24 events (all good), 2 – 6 s, baseline off, ~4.1 MB, data loaded,
 'left_hand': 12
 'right_hand': 12>
  warn(f"warnEpochs {epochs}")

BNCI2014-001-CrossSession: 100%|##########| 4/4 [00:36<00:00, 10.12s/it]
BNCI2014-001-CrossSession: 100%|##########| 4/4 [00:36<00:00,  9.11s/it]

MOABB Plotting#

Here we plot the results using some of the convenience methods within the toolkit. The score_plot visualizes all the data with one score per subject for every dataset and pipeline.

Scores per dataset and algorithm
/home/runner/work/moabb/moabb/moabb/analysis/plotting.py:70: UserWarning: The palette list has more values (6) than needed (4), which may not be intended.
  sea.stripplot(

For a comparison of two algorithms, there is the paired_plot, which plots performance in one versus the performance in the other over all chosen datasets. Note that there is only one score per subject, regardless of the number of sessions.

fig = moabb_plt.paired_plot(results, "CSP+LDA", "RG+LDA")
plt.show()
plot statistical analysis

Statistical Testing and Further Plots#

If the statistical significance of results is of interest, the method compute_dataset_statistics allows one to show a meta-analysis style plot as well. For an overview of how all algorithms perform in comparison with each other, the method find_significant_differences and the summary_plot are possible.

The meta-analysis style plot shows the standardized mean difference within each tested dataset for the two algorithms in question, in addition to a meta-effect and significance both per-dataset and overall.

fig = moabb_plt.meta_analysis_plot(stats, "CSP+LDA", "RG+LDA")
plt.show()
< RG+LDA better                                                                              CSP+LDA better >, p-value

The summary plot shows the effect and significance related to the hypothesis that the algorithm on the y-axis significantly outperformed the algorithm on the x-axis over all datasets

Algorithm comparison

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

Estimated memory usage: 291 MB

Gallery generated by Sphinx-Gallery