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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:05<00:17,  5.82s/it]/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:11<00:11,  5.64s/it]/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py:1064: 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:52, 67.5kB/s]

  0%|                                      | 32.8k/44.1M [00:00<05:02, 146kB/s]

  0%|                                      | 96.3k/44.1M [00:00<02:19, 316kB/s]

  0%|▏                                      | 209k/44.1M [00:00<01:19, 553kB/s]

  1%|▎                                     | 432k/44.1M [00:00<00:43, 1.01MB/s]

  2%|▊                                     | 889k/44.1M [00:00<00:22, 1.93MB/s]

  4%|█▌                                   | 1.80M/44.1M [00:00<00:11, 3.72MB/s]

  8%|███                                  | 3.62M/44.1M [00:00<00:05, 7.26MB/s]

 15%|█████▋                               | 6.74M/44.1M [00:01<00:02, 12.9MB/s]

 22%|████████                             | 9.58M/44.1M [00:01<00:02, 16.1MB/s]

 27%|██████████                           | 12.0M/44.1M [00:01<00:01, 17.3MB/s]

 34%|████████████▍                        | 14.8M/44.1M [00:01<00:01, 18.9MB/s]

 40%|██████████████▊                      | 17.6M/44.1M [00:01<00:01, 20.1MB/s]

 46%|█████████████████                    | 20.3M/44.1M [00:01<00:01, 20.5MB/s]

 52%|███████████████████▍                 | 23.1M/44.1M [00:01<00:00, 21.3MB/s]

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

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

 71%|██████████████████████████▎          | 31.4M/44.1M [00:02<00:00, 22.1MB/s]

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

 84%|██████████████████████████████▉      | 36.9M/44.1M [00:02<00:00, 22.2MB/s]

 90%|█████████████████████████████████▎   | 39.6M/44.1M [00:02<00:00, 22.3MB/s]

 96%|███████████████████████████████████▋ | 42.4M/44.1M [00:02<00:00, 22.4MB/s]

  0%|                                              | 0.00/44.1M [00:00<?, ?B/s]
100%|██████████████████████████████████████| 44.1M/44.1M [00:00<00:00, 173GB/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 '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:29, 67.2kB/s]

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

  0%|                                      | 88.1k/42.3M [00:00<02:28, 284kB/s]

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

  1%|▍                                      | 409k/42.3M [00:00<00:43, 955kB/s]

  2%|▊                                     | 841k/42.3M [00:00<00:22, 1.82MB/s]

  4%|█▍                                   | 1.70M/42.3M [00:00<00:11, 3.51MB/s]

  8%|██▉                                  | 3.42M/42.3M [00:00<00:05, 6.83MB/s]

 15%|█████▋                               | 6.50M/42.3M [00:01<00:02, 12.5MB/s]

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

 29%|██████████▌                          | 12.1M/42.3M [00:01<00:01, 18.7MB/s]

 35%|████████████▊                        | 14.7M/42.3M [00:01<00:01, 19.7MB/s]

 41%|███████████████▎                     | 17.5M/42.3M [00:01<00:01, 20.7MB/s]

 49%|█████████████████▉                   | 20.6M/42.3M [00:01<00:00, 22.0MB/s]

 56%|████████████████████▌                | 23.6M/42.3M [00:01<00:00, 22.5MB/s]

 63%|███████████████████████▏             | 26.6M/42.3M [00:01<00:00, 23.0MB/s]

 70%|█████████████████████████▉           | 29.7M/42.3M [00:02<00:00, 23.7MB/s]

 77%|████████████████████████████▌        | 32.7M/42.3M [00:02<00:00, 24.0MB/s]

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

 91%|█████████████████████████████████▊   | 38.7M/42.3M [00:02<00:00, 24.0MB/s]

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

  0%|                                              | 0.00/42.3M [00:00<?, ?B/s]
100%|██████████████████████████████████████| 42.3M/42.3M [00:00<00:00, 174GB/s]
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:23<00:08,  8.80s/it]/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py:1064: 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<09:10, 67.4kB/s]

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

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

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

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

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

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

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

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

 26%|█████████▌                           | 9.61M/37.2M [00:01<00:01, 16.2MB/s]

 33%|████████████▏                        | 12.2M/37.2M [00:01<00:01, 17.8MB/s]

 41%|███████████████▏                     | 15.2M/37.2M [00:01<00:01, 19.7MB/s]

 49%|█████████████████▉                   | 18.1M/37.2M [00:01<00:00, 20.8MB/s]

 56%|████████████████████▉                | 21.0M/37.2M [00:01<00:00, 21.6MB/s]

 65%|███████████████████████▉             | 24.0M/37.2M [00:01<00:00, 22.5MB/s]

 72%|██████████████████████████▋          | 26.8M/37.2M [00:01<00:00, 22.5MB/s]

 80%|█████████████████████████████▋       | 29.8M/37.2M [00:02<00:00, 23.1MB/s]

 88%|████████████████████████████████▌    | 32.7M/37.2M [00:02<00:00, 23.0MB/s]

 96%|███████████████████████████████████▍ | 35.6M/37.2M [00:02<00:00, 23.2MB/s]

  0%|                                              | 0.00/37.2M [00:00<?, ?B/s]
100%|██████████████████████████████████████| 37.2M/37.2M [00:00<00:00, 157GB/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 '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<10:22, 67.0kB/s]

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

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

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

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

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

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

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

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

 23%|████████▌                            | 9.68M/41.7M [00:01<00:01, 16.2MB/s]

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

 37%|█████████████▌                       | 15.3M/41.7M [00:01<00:01, 19.7MB/s]

 44%|████████████████                     | 18.2M/41.7M [00:01<00:01, 20.7MB/s]

 51%|██████████████████▋                  | 21.1M/41.7M [00:01<00:00, 21.6MB/s]

 57%|█████████████████████▎               | 24.0M/41.7M [00:01<00:00, 22.2MB/s]

 65%|███████████████████████▉             | 26.9M/41.7M [00:01<00:00, 22.7MB/s]

 72%|██████████████████████████▍          | 29.9M/41.7M [00:02<00:00, 23.0MB/s]

 79%|█████████████████████████████        | 32.8M/41.7M [00:02<00:00, 23.2MB/s]

 86%|███████████████████████████████▋     | 35.7M/41.7M [00:02<00:00, 23.3MB/s]

 93%|██████████████████████████████████▎  | 38.7M/41.7M [00:02<00:00, 23.6MB/s]

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

  0%|                                              | 0.00/41.7M [00:00<?, ?B/s]
100%|██████████████████████████████████████| 41.7M/41.7M [00:00<00:00, 181GB/s]
/home/runner/work/moabb/moabb/moabb/datasets/preprocessing.py:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:279: 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:35<00:00, 10.10s/it]
BNCI2014-001-CrossSession: 100%|##########| 4/4 [00:35<00:00,  8.99s/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 46.779 seconds)

Estimated memory usage: 306 MB

Gallery generated by Sphinx-Gallery