Skip to content

Commit

Permalink
Deprecated deep learning (#666)
Browse files Browse the repository at this point in the history
* MNT: fixing the numpy 2.0

* DOC: fixing the docstring

* DOC: fixing the docstring

* DOC: fixing more numpy

* DOC: deprecated braindecode inside moabb module in favor of braindecode

* DOC: updating whats_new.rst file

* DOC: fixing whats_new.rst

* DOC: fixing api doc rst

* DOC: removing braindecode

* DOC: removing braindecode

* [FIX] removing optional poetry dependancy.

* [FIX] removing options about braindecode

* [FIX] removing options about braindecode

* [FIX] removing braindecode

* [FIX] removing braindecode
  • Loading branch information
bruAristimunha authored Jan 28, 2025
1 parent 0c2cd0a commit fa295b1
Show file tree
Hide file tree
Showing 17 changed files with 5 additions and 1,117 deletions.
2 changes: 0 additions & 2 deletions docs/source/pipelines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,3 @@ Base & Utils
utils_deep_model.EEGNet
utils_deep_model.EEGNet_TC
utils_deep_model.TCN_block
utils_pytorch.BraindecodeDatasetLoader
utils_pytorch.InputShapeSetterEEG
1 change: 1 addition & 0 deletions docs/source/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Bugs

API changes
~~~~~~~~~~~
- Removing the braindecode module from inside moabb (:gh:`666` by `Bruno Aristimunha`_ )

Version - 1.1.1 (Stable - PyPi)
---------------------------------
Expand Down
52 changes: 2 additions & 50 deletions examples/load_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
==============================================
Load Model (Scikit, Pytorch, Keras) with MOABB
Load Model (Scikit, Keras) with MOABB
==============================================
This example shows how to use load the pretrained pipeline in MOABB.
Expand All @@ -13,13 +13,8 @@
from pickle import load

import keras
import torch
from braindecode import EEGClassifier
from braindecode.models import EEGInception
from scikeras.wrappers import KerasClassifier
from sklearn.pipeline import Pipeline, make_pipeline
from skorch.callbacks import EarlyStopping, EpochScoring
from skorch.dataset import ValidSplit
from sklearn.pipeline import Pipeline

from moabb import set_log_level
from moabb.pipelines.features import StandardScaler_Epoch
Expand Down Expand Up @@ -66,46 +61,3 @@
("Keras_DeepConvNet_Trained", Keras_DeepConvNet_Trained),
]
)

###############################################################################
# Loading the PyTorch model

# Hyperparameter
LEARNING_RATE = 0.0001
WEIGHT_DECAY = 0
BATCH_SIZE = 64
SEED = 42
VERBOSE = 1
EPOCH = 2
PATIENCE = 3

# Define a Skorch classifier
clf = EEGClassifier(
module=EEGInception,
optimizer=torch.optim.Adam,
optimizer__lr=LEARNING_RATE,
batch_size=BATCH_SIZE,
max_epochs=EPOCH,
train_split=ValidSplit(0.2, random_state=SEED),
callbacks=[
EarlyStopping(monitor="valid_loss", patience=PATIENCE),
EpochScoring(
scoring="accuracy", on_train=True, name="train_acc", lower_is_better=False
),
EpochScoring(
scoring="accuracy", on_train=False, name="valid_acc", lower_is_better=False
),
],
verbose=VERBOSE, # Not printing the results for each epoch
)

clf.initialize()

f_params = "./results/Models_CrossSession/BNCI2014-001/1/braindecode_EEGInception/EEGInception_fitted_best_model.pkl"
f_optimizer = "./results/Models_CrossSession/BNCI2014-001/1/braindecode_EEGInception/EEGInception_fitted_best_optim.pkl"
f_history = "./results/Models_CrossSession/BNCI2014-001/1/braindecode_EEGInception/EEGInception_fitted_best_history.json"

clf.load_params(f_params=f_params, f_optimizer=f_optimizer, f_history=f_history)

# Create the pipelines
pipes_pytorch = make_pipeline(clf)
59 changes: 0 additions & 59 deletions examples/pipelines_braindecode/braindecode_EEGInception.py

This file was deleted.

59 changes: 0 additions & 59 deletions examples/pipelines_braindecode/braindecode_EEGNetv4.py

This file was deleted.

59 changes: 0 additions & 59 deletions examples/pipelines_braindecode/braindecode_ShallowFBCSPNet.py

This file was deleted.

122 changes: 0 additions & 122 deletions examples/plot_benchmark_braindecode.py

This file was deleted.

Loading

0 comments on commit fa295b1

Please sign in to comment.