Last active
November 13, 2015 19:33
-
-
Save alexandrebarachant/0b84d66ca6a6db499dc8 to your computer and use it in GitHub Desktop.
pyRiemann Motor imagery template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyriemann.estimation import Covariances | |
from pyriemann.tangentspace import TangentSpace | |
from sklearn.pipeline import make_pipeline | |
from sklearn.linear_model import LogisticRegression | |
from sklearn.cross_validation import cross_val_score | |
# load your data | |
X = ... # your EEG data, in format Ntrials x Nchannels X Nsamples | |
y = ... # the labels | |
# Make sure your data are band-pass filtered | |
# build your pipeline | |
clf = make_pipeline(Covariances(estimator='lwf'), | |
TangentSpace(metric='riemann'), | |
LogisticRegression()) | |
# cross validation | |
auc = cross_val_score(clf, X, y, scoring='roc_auc') | |
print(auc.mean()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment