Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Dec 17, 2024
1 parent bbb8421 commit a9c34ec
Showing 1 changed file with 43 additions and 28 deletions.
71 changes: 43 additions & 28 deletions examples/ERP/noplot_nch_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,41 @@
# Modified from noplot_classify_P300_nch.py
# License: BSD (3-clause)

import random
import warnings

import numpy as np
import random
import qiskit_algorithms

import seaborn as sns
from matplotlib import pyplot as plt
from moabb import set_log_level
from moabb.datasets import bi2013a, bi2012, Cattan2019_VR, Cattan2019_PHMD
from moabb.datasets import Cattan2019_PHMD, Cattan2019_VR, bi2012, bi2013a
from moabb.datasets.compound_dataset import Cattan2019_VR_Il
from moabb.evaluations import WithinSessionEvaluation, CrossSessionEvaluation, CrossSubjectEvaluation
from moabb.evaluations import (
CrossSessionEvaluation,
CrossSubjectEvaluation,
WithinSessionEvaluation,
)
from moabb.paradigms import P300, RestingStateToP300Adapter
from pyriemann.classification import MDM
from pyriemann.estimation import XdawnCovariances, Covariances, Shrinkage, ERPCovariances
import seaborn as sns
from sklearn.pipeline import make_pipeline
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
from pyriemann_qiskit.pipelines import QuantumMDMWithRiemannianPipeline
from qiskit_algorithms.optimizers import SPSA, COBYLA, SLSQP
from pyriemann.estimation import XdawnCovariances
from pyriemann.estimation import (
Covariances,
ERPCovariances,
Shrinkage,
XdawnCovariances,
)
from pyriemann.spatialfilters import CSP
from pyriemann.tangentspace import TangentSpace
from qiskit_algorithms.optimizers import COBYLA, SLSQP, SPSA
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
from sklearn.pipeline import make_pipeline

from pyriemann_qiskit.classification import QuanticNCH
from pyriemann_qiskit.utils.hyper_params_factory import create_mixer_rotational_X_gates, create_mixer_rotational_XY_gates
from pyriemann.spatialfilters import CSP
from pyriemann_qiskit.pipelines import QuantumMDMWithRiemannianPipeline
from pyriemann_qiskit.utils.hyper_params_factory import (
create_mixer_rotational_X_gates,
create_mixer_rotational_XY_gates,
)

print(__doc__)

Expand Down Expand Up @@ -122,7 +134,7 @@
create_mixer=create_mixer_rotational_X_gates(0),
shots=100,
qaoa_optimizer=SPSA(maxiter=100, blocking=False),
n_reps=2
n_reps=2,
),
)

Expand All @@ -149,7 +161,7 @@
create_mixer=create_mixer_rotational_X_gates(0),
shots=100,
qaoa_optimizer=SPSA(maxiter=100, blocking=False),
n_reps=2
n_reps=2,
),
)

Expand All @@ -172,15 +184,18 @@
)

pipelines["TS+LDA"] = make_pipeline(
sf,
TangentSpace(metric="riemann"),
LDA(),
)
sf,
TangentSpace(metric="riemann"),
LDA(),
)

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

evaluation = CrossSubjectEvaluation(
paradigm=paradigm, datasets=datasets, suffix="examples", overwrite=overwrite,
paradigm=paradigm,
datasets=datasets,
suffix="examples",
overwrite=overwrite,
n_splits=3,
random_state=seed,
)
Expand All @@ -199,14 +214,14 @@
fig, ax = plt.subplots(facecolor="white", figsize=[8, 4])

order = [
'NCH+RANDOM_HULL',
'NCH+RANDOM_HULL_NAIVEQAOA',
'NCH+RANDOM_HULL_QAOACV',
'NCH+MIN_HULL',
'NCH+MIN_HULL_NAIVEQAOA',
'NCH+MIN_HULL_QAOACV',
'TS+LDA',
'MDM'
"NCH+RANDOM_HULL",
"NCH+RANDOM_HULL_NAIVEQAOA",
"NCH+RANDOM_HULL_QAOACV",
"NCH+MIN_HULL",
"NCH+MIN_HULL_NAIVEQAOA",
"NCH+MIN_HULL_QAOACV",
"TS+LDA",
"MDM",
]

sns.stripplot(
Expand Down

0 comments on commit a9c34ec

Please sign in to comment.