Skip to content

Commit

Permalink
Update pipelines (#326)
Browse files Browse the repository at this point in the history
* add/cleaning n_class motor imagery pipelines

* Try Configuration

* DL benchmark, problem with the callbacks and yml file

* DL benchmark without Callbacks

* DL benchmark with Callbacks

* DL benchmark with Callbacks

* DL benchmark with Callbacks - Bug of test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* DL benchmark with Callbacks - Fix Suggestion

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* Adding pipeline Augmented Covariance Matrix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* Fix Keras Name

* Fix Keras Name and Add documentation Augmented Dataset

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* Renaming the file to Keras EEGNet

* Removing imported but not unused

* Fixing B008

* Adding parameter --with deeplearning for CI

* Restoring

* Keras mapping with Callbacks and Optimizer. Added DL model:
- ShallowConvNet
- DeepConvNet
 EEGNet_8_2

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* Added DL model:
- EEGITNet
- EEGTCNet
- EEGNeX

* Added DL model:
- EEGITNet
- EEGTCNet
- EEGNeX

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* Tensforlow import bug

* Tensforlow import bug

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* Removing --no-dev flag.

* Updating __init__ file to expose the deep learning methods.

* Renaming the file, functions; Cleaning imports; Adding docs; snake_case style for variable;

* Renaming the file, functions; Cleaning imports; Adding docs; snake_case style for variable; Trying to solve B008 (not define function in the args).

* changing name for variable

* Updating yaml with the new path

* Fixing e-mail and renaming again.

* Trying to solve the windows point.

* tmp removing windows until I figure out how to work

* adding the runs-on: ${{ matrix.os }}

* Updating whats_new.rst

* missed dot

* updating models name

* Reduced Epoch and Batch size for a fast example

* Updated paradigm:
- LeftRightImagery
- MotorImagery

Added Keras pipeline to Pipelines folder

Added new pipelines:
- CSP + SVM grid
- EN Grid
- FgMDM
- regCSP+shLDA Grid
- TSSVM Grid

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* Modification requested by Sylavin

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* Modification requested by Sylavin

* Fix EEGTCNet.

Add Standardization of input for:
- EEGNet
- ShallowNet
- DeepConNet
- EEGTCNet

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* Add Standardization of input for every KERAS pipeline

* trying to restore test on windows, without tensorflow

* import tensorflow only when needed

* print warning if tensorflow not installed

* switch dev-dep to group docs

* switch to docs and re-enable windows in test

* correct error

* Update moabb/pipelines/deep_learning.py

Co-authored-by: Sylvain Chevallier <sylvain.chevallier@universite-paris-saclay.fr>

* Update moabb/pipelines/deep_learning.py

Co-authored-by: Sylvain Chevallier <sylvain.chevallier@universite-paris-saclay.fr>

* Update moabb/pipelines/deep_learning.py

Co-authored-by: Sylvain Chevallier <sylvain.chevallier@universite-paris-saclay.fr>

* Update moabb/pipelines/deep_learning.py

Co-authored-by: Sylvain Chevallier <sylvain.chevallier@universite-paris-saclay.fr>

* Update moabb/pipelines/deep_learning.py

Co-authored-by: Sylvain Chevallier <sylvain.chevallier@universite-paris-saclay.fr>

* Update moabb/pipelines/deep_learning.py

Co-authored-by: Sylvain Chevallier <sylvain.chevallier@universite-paris-saclay.fr>

* Update examples/plot_benchmark_DL.py

* Apply suggestions from code review

* fix precommit

* correct example

* correct typo

* add names and references

* add new class/fct in API

* add setup_seed and set_download_dir in init and doc API

* remove text

---------

Co-authored-by: Sylvain Chevallier <sylain.chevallier@universite-paris-saclay.fr>
Co-authored-by: CARRARA Igor <igor.carrara@inria.fr>
Co-authored-by: Bru <a.bruno@aluno.ufabc.edu.br>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Igor Carrara <94047258+carraraig@users.noreply.github.com>
  • Loading branch information
6 people committed Mar 3, 2023
1 parent 9ec412f commit f48b6c9
Show file tree
Hide file tree
Showing 43 changed files with 1,966 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ jobs:
- name: Install dependencies
if: steps.cached-dataset-docs.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root --with deeplearning
run: poetry install --no-interaction --no-root --with docs,deeplearning

- name: Install library
run: poetry install --no-interaction --with deeplearning
run: poetry install --no-interaction --with docs,deeplearning

- name: Build docs
run: |
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/test-devel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,15 @@ jobs:
if: |
(runner.os != 'Windows') &&
(steps.cached-poetry-dependencies.outputs.cache-hit != 'true')
run: poetry install --no-interaction --no-root --with deeplearning --no-dev
run: poetry install --no-interaction --no-root --with deeplearning

- name: Install library
run: poetry install --no-interaction --with deeplearning --no-dev
- name: Install library (Linux/OSX)
if: ${{ runner.os != 'Windows' }}
run: poetry install --no-interaction --with deeplearning

- name: Install library (Windows)
if: ${{ runner.os == 'Windows' }}
run: poetry install --no-interaction

- name: Run tests
run: |
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,16 @@ jobs:
if: |
(runner.os != 'Windows') &&
(steps.cached-poetry-dependencies.outputs.cache-hit != 'true')
run: poetry install --no-interaction --no-root --with deeplearning --no-dev
run: poetry install --no-interaction --no-root --with deeplearning

- name: Install dependencies
if: |
(runner.os != 'Windows') &&
(steps.cached-poetry-dependencies.outputs.cache-hit != 'true')
run: poetry install --no-interaction --no-root --with deeplearning

- name: Install library
run: poetry install --no-interaction --with deeplearning --no-dev
run: poetry install --no-interaction --with deeplearning

- name: Run tests
run: |
Expand Down
2 changes: 2 additions & 0 deletions contexts/mi_n_class.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MotorImagery:
n_classes: 3
12 changes: 12 additions & 0 deletions docs/source/pipelines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,17 @@ Pipelines
features.LogVariance
features.FM
features.ExtendedSSVEPSignal
features.AugmentedDataset
features.StandardScaler_Epoch
csp.TRCSP
classification.SSVEP_CCA
deep_learning.KerasDeepConvNet
deep_learning.KerasEEGITNet
deep_learning.KerasEEGNet_8_2
deep_learning.KerasEEGNeX
deep_learning.KerasEEGTCNet
deep_learning.KerasShallowConvNet


------------
Base & Utils
Expand All @@ -30,3 +39,6 @@ Base & Utils

utils.create_pipeline_from_config
utils.FilterBank
utils_deep_model.EEGNet
utils_deep_model.EEGNet_TC
utils_deep_model.TCN_block
2 changes: 2 additions & 0 deletions docs/source/utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ Utils
:template: function.rst

set_log_level
setup_seed
set_download_dir
2 changes: 2 additions & 0 deletions docs/source/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Enhancements
- Adding a comprehensive benchmarking function (:gh:`264` by `Divyesh Narayanan`_ and `Sylvain Chevallier`_)
- Add meta-information for datasets in documentation (:gh:`317` by `Bruno Aristimunha`_)
- Add GridSearchCV for different evaluation procedure (:gh:`319` by `Igor Carrara`_)
- Add six deep learning models (Tensorflow), and build a tutorial to show to used the deep learning model (:gh:`326` by `Igor Carrara`_, `Bruno Aristimunha`_ and `Sylvain Chevallier`_)
- Add a augmentation model to the pipeline (:gh:`326` by `Igor Carrara`_)

Bugs
~~~~
Expand Down
40 changes: 40 additions & 0 deletions examples/pipelines_DL/Keras_DeepConvNet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Keras_DeepConvNet

paradigms:
- LeftRightImagery
- MotorImagery

citations:
- https://doi.org/10.1002/hbm.23730

pipeline:
- name: StandardScaler_Epoch
from: moabb.pipelines.features

- name: KerasDeepConvNet
from: moabb.pipelines.deep_learning
parameters:
loss: "sparse_categorical_crossentropy"
optimizer:
- name: Adam
from: tensorflow.keras.optimizers.legacy
parameters:
learning_rate: 0.0009
epochs: 2
batch_size: 1
verbose: 0
random_state: 42
validation_split: 0.2
callbacks:
- name: EarlyStopping
from: tensorflow.keras.callbacks
parameters:
monitor: "val_loss"
patience: 300

- name: ReduceLROnPlateau
from: tensorflow.keras.callbacks
parameters:
monitor: "val_loss"
patience: 300
factor: 0.5
40 changes: 40 additions & 0 deletions examples/pipelines_DL/Keras_EEGITNet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Keras_EEGITNet

paradigms:
- LeftRightImagery
- MotorImagery

citations:
- https://doi.org/10.1109/ACCESS.2022.3161489

pipeline:
- name: StandardScaler_Epoch
from: moabb.pipelines.features

- name: KerasEEGITNet
from: moabb.pipelines.deep_learning
parameters:
loss: "sparse_categorical_crossentropy"
optimizer:
- name: Adam
from: tensorflow.keras.optimizers.legacy
parameters:
learning_rate: 0.0009
epochs: 2
batch_size: 1
verbose: 0
random_state: 42
validation_split: 0.2
callbacks:
- name: EarlyStopping
from: tensorflow.keras.callbacks
parameters:
monitor: "val_loss"
patience: 300

- name: ReduceLROnPlateau
from: tensorflow.keras.callbacks
parameters:
monitor: "val_loss"
patience: 300
factor: 0.5
40 changes: 40 additions & 0 deletions examples/pipelines_DL/Keras_EEGNeX.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Keras_EEGNeX

paradigms:
- LeftRightImagery
- MotorImagery

citations:
- https://doi.org/10.48550/arXiv.2207.12369

pipeline:
- name: StandardScaler_Epoch
from: moabb.pipelines.features

- name: KerasEEGNeX
from: moabb.pipelines.deep_learning
parameters:
loss: "sparse_categorical_crossentropy"
optimizer:
- name: Adam
from: tensorflow.keras.optimizers.legacy
parameters:
learning_rate: 0.0009
epochs: 2
batch_size: 1
verbose: 0
random_state: 42
validation_split: 0.2
callbacks:
- name: EarlyStopping
from: tensorflow.keras.callbacks
parameters:
monitor: "val_loss"
patience: 300

- name: ReduceLROnPlateau
from: tensorflow.keras.callbacks
parameters:
monitor: "val_loss"
patience: 300
factor: 0.5
40 changes: 40 additions & 0 deletions examples/pipelines_DL/Keras_EEGNet_8_2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Keras_EEGNet_8_2

paradigms:
- LeftRightImagery
- MotorImagery

citations:
- https://doi.org/10.1088/1741-2552/aace8c

pipeline:
- name: StandardScaler_Epoch
from: moabb.pipelines.features

- name: KerasEEGNet_8_2
from: moabb.pipelines.deep_learning
parameters:
loss: "sparse_categorical_crossentropy"
optimizer:
- name: Adam
from: tensorflow.keras.optimizers.legacy
parameters:
learning_rate: 0.0009
epochs: 2
batch_size: 1
verbose: 0
random_state: 42
validation_split: 0.2
callbacks:
- name: EarlyStopping
from: tensorflow.keras.callbacks
parameters:
monitor: "val_loss"
patience: 300

- name: ReduceLROnPlateau
from: tensorflow.keras.callbacks
parameters:
monitor: "val_loss"
patience: 300
factor: 0.5
40 changes: 40 additions & 0 deletions examples/pipelines_DL/Keras_EEGTCNet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Keras_EEGTCNet

paradigms:
- LeftRightImagery
- MotorImagery

citations:
- https://doi.org/10.1109/SMC42975.2020.9283028

pipeline:
- name: StandardScaler_Epoch
from: moabb.pipelines.features

- name: KerasEEGTCNet
from: moabb.pipelines.deep_learning
parameters:
loss: "sparse_categorical_crossentropy"
optimizer:
- name: Adam
from: tensorflow.keras.optimizers.legacy
parameters:
learning_rate: 0.0009
epochs: 2
batch_size: 1
verbose: 0
random_state: 42
validation_split: 0.2
callbacks:
- name: EarlyStopping
from: tensorflow.keras.callbacks
parameters:
monitor: "val_loss"
patience: 300

- name: ReduceLROnPlateau
from: tensorflow.keras.callbacks
parameters:
monitor: "val_loss"
patience: 300
factor: 0.5
40 changes: 40 additions & 0 deletions examples/pipelines_DL/Keras_ShallowConvNet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Keras_ShallowConvNet

paradigms:
- LeftRightImagery
- MotorImagery

citations:
- https://doi.org/10.1002/hbm.23730

pipeline:
- name: StandardScaler_Epoch
from: moabb.pipelines.features

- name: KerasShallowConvNet
from: moabb.pipelines.deep_learning
parameters:
loss: "sparse_categorical_crossentropy"
optimizer:
- name: Adam
from: tensorflow.keras.optimizers.legacy
parameters:
learning_rate: 0.0009
epochs: 2
batch_size: 1
verbose: 0
random_state: 42
validation_split: 0.2
callbacks:
- name: EarlyStopping
from: tensorflow.keras.callbacks
parameters:
monitor: "val_loss"
patience: 300

- name: ReduceLROnPlateau
from: tensorflow.keras.callbacks
parameters:
monitor: "val_loss"
patience: 300
factor: 0.5

0 comments on commit f48b6c9

Please sign in to comment.