Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addins bayesian optimization functionnality with skopt #9

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

**/*.ipynb_checkpoints
__pycache__
/.vscode/
Empty file added brainDecode/__init__.py
Empty file.
Empty file.
21 changes: 21 additions & 0 deletions brainDecode/towardMoabbIntegration/utils/bayesian.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

from skopt import BayesSearchCV
from skopt.space import Categorical, Real, Integer
from brainDecode.towardMoabbIntegration.brainDecodeSKLearnWrapper.ShallowFBCSPNet_GeneralTrainer import ShallowFBCSPNet_GeneralTrainer


def bayes_optimize(classifier=None, X_train=None, Y_train=None):
classifier = ShallowFBCSPNet_GeneralTrainer(nb_epoch=25)

searches = { # This should containt Dimension instances (Reals, Integer, or Categorical)
"n_filters_time":Integer(5, 15),
"filter_time_length":Integer(50,75),
"n_filters_spat":Integer(3,10),
"pool_time_length":Integer(50,80),
"pool_time_stride":Integer(20,40)
}

bayes_optmizer = BayesSearchCV(classifier, searches)

# now fit and profit
bayes_optmizer.fit(X_train, Y_train)
7 changes: 7 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
mne>=0.16.1
seaborn
pandas
scikit-learn
torch==0.4.0
braindecode==0.4.5
scikit-optimize==0.5.2