pyriemann_qiskit.classification.QuanticNCH¶
- class pyriemann_qiskit.classification.QuanticNCH(quantum=True, q_account_token=None, verbose=True, shots=1024, seed=None, upper_bound=7, regularization=None, n_jobs=6, classical_optimizer=None, n_hulls_per_class=3, n_samples_per_hull=10, subsampling='min', qaoa_optimizer=None, create_mixer=None, n_reps=3, qaoa_initial_points=None, qaoacv_implementation=None)[source]¶
A Quantum wrapper around the NCH algorithm.
It allows both classical and Quantum versions to be executed.
Notes
Added in version 0.2.0.
Changed in version 0.3.0: Add qaoa_optimizer parameter.
Changed in version 0.4.0: Add QAOA-CV optimization.
Changed in version 0.4.1: Add the qaoa_initial_points parameter.
Changed in version 0.5.0: Add the qaoacv_implementation parameter.
Changed in version 0.6.0: Moved to
pyriemann_qiskit.classification.wrappers.quantic_nch.- Parameters:
quantum (bool, default=True) –
Only applies if metric contains a cpm distance or mean.
If true will run on local or remote backend (depending on q_account_token value),
If false, will perform classical computing instead.
q_account_token (string | None, default=None) – If quantum is True and q_account_token provided, the classification task will be running on a IBM quantum backend. If load_account is provided, the classifier will use the previous token saved with IBMProvider.save_account().
verbose (bool, default=True) – If true, will output all intermediate results and logs.
shots (int, default=1024) – Number of repetitions of each circuit, for sampling.
seed (int | None, default=None) – Random seed for the simulation
upper_bound (int, default=7) – The maximum integer value for matrix normalization.
regularization (MixinTransformer | None, default=None) – Additional post-processing to regularize means.
classical_optimizer (OptimizationAlgorithm, default=SlsqpOptimizer()) – An instance of OptimizationAlgorithm [1].
n_jobs (int, default=6) – The number of jobs to use for the computation. This works by computing each of the hulls in parallel.
n_hulls_per_class (int, default=3) – The number of hulls used per class.
n_samples_per_hull (int, default=15) – Defines how many samples are used to build a hull. -1 will include all samples per class.
subsampling ({"min", "random"}, default="min") – Subsampling strategy of training set to estimate distance to hulls. “min” estimates hull using the n_samples_per_hull closest matrices. “random” estimates hull using n_samples_per_hull random matrices.
qaoa_optimizer (SciPyOptimizer, default=SLSQP()) – An instance of a scipy optimizer to find the optimal weights for the parametric circuit (ansatz).
create_mixer (None | Callable[int, QuantumCircuit], default=None) – A delegate that takes into input an angle and returns a QuantumCircuit. This circuit is the mixer operator for the QAOA-CV algorithm. If None and quantum, the NaiveQAOAOptimizer will be used instead.
n_reps (int, default=3) – The number of time the mixer and cost operator are repeated in the QAOA-CV circuit.
qaoa_initial_points (Tuple[int, int], default=[0.0, 0.0].) – Starting parameters (beta and gamma) for the NaiveQAOAOptimizer.
qaoacv_implementation ({"ulvi", "luna"} | None, default=None) – QAOA-CV implementation variant. When create_mixer is provided: “ulvi” selects QAOACVAngleOptimizer, “luna” or other string values select QAOACVOptimizer. If None, uses default QAOA-CV behavior.
References
- __init__(quantum=True, q_account_token=None, verbose=True, shots=1024, seed=None, upper_bound=7, regularization=None, n_jobs=6, classical_optimizer=None, n_hulls_per_class=3, n_samples_per_hull=10, subsampling='min', qaoa_optimizer=None, create_mixer=None, n_reps=3, qaoa_initial_points=None, qaoacv_implementation=None)[source]¶
Examples using pyriemann_qiskit.classification.QuanticNCH¶
Classification of P300 datasets from MOABB using NCH
Toy dataset ablation study — NCH vs MDM with/without Transfer Learning
QAOA circuit depth ablation study — n_reps vs AUC and training time