Skip to content

Commit

Permalink
Revert "test modification of example to see if google cloud run it."
Browse files Browse the repository at this point in the history
This reverts commit 0eae2bf.
  • Loading branch information
gcattan committed Jun 29, 2022
1 parent ae4394a commit 64c1e3a
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions examples/ERP/classify_P300_bi.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import seaborn as sns
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
from moabb import set_log_level
from moabb.datasets import bi2012, bi2013a
from moabb.datasets import bi2012
from moabb.evaluations import WithinSessionEvaluation
from moabb.paradigms import P300
from pyriemann_qiskit.classification import \
Expand Down Expand Up @@ -62,7 +62,7 @@

paradigm = P300(resample=128)

datasets = [bi2012(), bi2013a()] # MOABB provides several other P300 datasets
datasets = [bi2012()] # MOABB provides several other P300 datasets

# reduce the number of subjects, the Quantum pipeline takes a lot of time
# if executed on the entire dataset
Expand All @@ -74,26 +74,36 @@

pipelines = {}


# Here we provide a pipeline for comparison:

# This is a standard pipeline similar to
# QuantumClassifierWithDefaultRiemannianPipeline, but with LDA classifier
# instead.
pipelines["RG+SVM"] = QuantumClassifierWithDefaultRiemannianPipeline(
shots=None, # 'None' forces classic SVM
nfilter=2, # default 2
dim_red=PCA(n_components=5),
)

# A Riemannian Quantum pipeline provided by pyRiemann-qiskit
# You can choose between classical SVM and Quantum SVM.
pipelines["RG+QuantumSVM"] = QuantumClassifierWithDefaultRiemannianPipeline(
shots=1024, # 'None' forces classic SVM
shots=None, # 'None' forces classic SVM
nfilter=2, # default 2
# default n_components=10, a higher value renders better performance with
# the non-qunatum SVM version used in qiskit
# On a real Quantum computer (n_components = qubits)
dim_red=PCA(n_components=5),
# params={'q_account_token': '<IBM Quantum TOKEN>'}
)

# Here we provide a pipeline for comparison:

# This is a standard pipeline similar to
# QuantumClassifierWithDefaultRiemannianPipeline, but with LDA classifier
# instead.
pipelines["RG+LDA"] = make_pipeline(
# applies XDawn and calculates the covariance matrix, output it matrices
XdawnCovariances(
nfilter=2,
classes=[labels_dict["Target"]],
estimator="lwf",
xdawn_estimator="scm"
),
TangentSpace(),
PCA(n_components=10),
LDA(solver="lsqr", shrinkage="auto"), # you can use other classifiers
)

print("Total pipelines to evaluate: ", len(pipelines))

evaluation = WithinSessionEvaluation(
Expand Down

0 comments on commit 64c1e3a

Please sign in to comment.