FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add TRCA algorithm (#238) · NeuralLabBIT/moabb@70d27fd · GitHub

Repository navigation

Commit 70d27fd

Browse files
andauthored
Add TRCA algorithm (NeuroTechX#238)
* Add TRCA algorithm and one example * Minor changes to filterbank * pre-commit changes * pre-commit more fixes * Schaefer-Strimmer covariance now in Pyriemann * Update moabb/pipelines/classification.py Co-authored-by: Sylvain Chevallier <sylvain.chevallier@uvsq.fr> * Apply suggestions from code review Co-authored-by: Sylvain Chevallier <sylvain.chevallier@uvsq.fr> * Apply changes from code review * pre-commit corrections * Update moabb/datasets/base.py * Apply suggestions from code review Co-authored-by: Sylvain Chevallier <sylvain.chevallier@uvsq.fr> * Last namming changes * Forgot one namming change * update var naming and docstrings * rename X variable Co-authored-by: Sylvain Chevallier <sylvain.chevallier@uvsq.fr>
1 parent 9137537 commit 70d27fd

4 files changed

Lines changed: 568 additions & 6 deletions

File tree

‎examples/plot_cross_subject_ssvep.py‎

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from moabb.datasets import SSVEPExo
2929
from moabb.evaluations import CrossSubjectEvaluation
3030
from moabb.paradigms import SSVEP, FilterBankSSVEP
31-
from moabb.pipelines import SSVEP_CCA, ExtendedSSVEPSignal
31+
from moabb.pipelines import SSVEP_CCA, SSVEP_TRCA, ExtendedSSVEPSignal
3232

3333

3434
warnings.simplefilter(action="ignore", category=FutureWarning)
@@ -55,15 +55,17 @@
5555
# Choose paradigm
5656
# ---------------
5757
#
58-
# We define the paradigms (SSVEP and FilterBankSSVEP) and use the dataset
58+
# We define the paradigms (SSVEP, SSSVEP_TRCA and FilterBankSSVEP) and use the dataset
5959
# SSVEPExo. The SSVEP paradigm applied a bandpass filter (10-25 Hz) on
60-
# the data while the FilterBankSSVEP paradigm uses as many bandpass filters as
60+
# the data, SSVEP_TRCA applied a bandpass filter (1-110 Hz) which correspond to almost
61+
# no filtering, while the FilterBankSSVEP paradigm uses as many bandpass filters as
6162
# there are stimulation frequencies (here 2). For each stimulation frequency
6263
# the EEG is filtered with a 1 Hz-wide bandpass filter centered on the
6364
# frequency. This results in ``n_classes`` copies of the signal, filtered for each
6465
# class, as used in filterbank motor imagery paradigms.
6566

6667
paradigm = SSVEP(fmin=10, fmax=25, n_classes=3)
68+
paradigm_TRCA = SSVEP(fmin=1, fmax=110, n_classes=3)
6769
paradigm_fb = FilterBankSSVEP(filters=None, n_classes=3)
6870

6971
###############################################################################
@@ -83,6 +85,7 @@
8385
# covariance matrices from the signal filtered around the considered
8486
# frequency and applying a logistic regression in the tangent plane.
8587
# The second pipeline relies on the above defined CCA classifier.
88+
# The third pipeline relies on TRCA algorithm.
8689

8790
pipelines_fb = {}
8891
pipelines_fb["RG+LogReg"] = make_pipeline(
@@ -95,6 +98,11 @@
9598
pipelines = {}
9699
pipelines["CCA"] = make_pipeline(SSVEP_CCA(interval=interval, freqs=freqs, n_harmonics=3))
97100

101+
pipelines_TRCA = {}
102+
pipelines_TRCA["TRCA"] = make_pipeline(
103+
SSVEP_TRCA(interval=interval, freqs=freqs, n_fbands=5)
104+
)
105+
98106
##############################################################################
99107
# Evaluation
100108
# ----------
@@ -123,9 +131,17 @@
123131
results_fb = evaluation_fb.process(pipelines_fb)
124132

125133
###############################################################################
126-
# After processing the two, we simply concatenate the results.
134+
# TRCA processing also relies on filter bank that is automatically designed.
135+
136+
evaluation_TRCA = CrossSubjectEvaluation(
137+
paradigm=paradigm_TRCA, datasets=dataset, overwrite=overwrite
138+
)
139+
results_TRCA = evaluation_TRCA.process(pipelines_TRCA)
140+
141+
###############################################################################
142+
# After processing the three, we simply concatenate the results.
127143

128-
results = pd.concat([results, results_fb])
144+
results = pd.concat([results, results_fb, results_TRCA])
129145

130146
##############################################################################
131147
# Plot Results

‎moabb/pipelines/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
with an sklearn compatible estimator.
55
"""
66
# flake8: noqa
7-
from .classification import SSVEP_CCA
7+
from .classification import SSVEP_CCA, SSVEP_TRCA
88
from .features import FM, ExtendedSSVEPSignal, LogVariance
99
from .utils import FilterBank, create_pipeline_from_config

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL