pyriemann_qiskit.classification.QuanticMDM

class pyriemann_qiskit.classification.QuanticMDM(metric={'distance': 'qlogeuclid_hull', 'mean': 'logeuclid'}, quantum=True, q_account_token=None, verbose=True, shots=1024, seed=None, upper_bound=7, regularization=None, classical_optimizer=None, qaoa_optimizer=None, create_mixer=None, n_reps=3, qaoa_initial_points=None, qaoacv_implementation=None)[source]

Quantum-enhanced MDM classifier

This class is a quantic implementation of the Minimum Distance to Mean (MDM) [1], which can run with quantum optimization. Only log-Euclidean distance between trial and class prototypes is supported at the moment, but any type of metric can be used for centroid estimation.

Notes

Added in version 0.0.4.

Changed in version 0.1.0: Fix: copy estimator not keeping base class parameters.

Changed in version 0.2.0: Add seed parameter. Add regularization parameter. Add classical_optimizer parameter.

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 qaoa_initial_points parameter.

Changed in version 0.4.2: Separate wrapper from algorithm (CpMDM)

Changed in version 0.5.0: Add the qaoacv_implementation parameter.

Changed in version 0.6.0: Moved to pyriemann_qiskit.classification.wrappers.quantic_mdm.

Parameters:
  • metric (string | dict, default={"mean": 'logeuclid', "distance": 'qlogeuclid_hull'}) – The type of metric used for centroid and distance estimation. see mean_covariance for the list of supported metric. the metric could be a dict with two keys, mean and distance in order to pass different metrics for the centroid estimation and the distance estimation.

  • quantum (bool, default=True) –

    Only applies if metric contains a quantic 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, default=None) – Additional post-processing to regularize means.

  • classical_optimizer (OptimizationAlgorithm, default=CobylaOptimizer()) – An instance of OptimizationAlgorithm [3].

  • 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 QAOACVOptimizer. If not quantum or not mixer provided, has no effect.

See also

QuanticClassifierBase, classification.algorithms.CpMDM, pyriemann.classification.MDM

References

[1]

Multiclass Brain-Computer Interface Classification by Riemannian Geometry A. Barachant, S. Bonnet, M. Congedo, and C. Jutten. IEEE Transactions on Biomedical Engineering, vol. 59, no. 4, p. 920-928, 2012.

[2]

Riemannian geometry applied to BCI classification A. Barachant, S. Bonnet, M. Congedo and C. Jutten. 9th International Conference Latent Variable Analysis and Signal Separation (LVA/ICA 2010), LNCS vol. 6365, 2010, p. 629-636.

__init__(metric={'distance': 'qlogeuclid_hull', 'mean': 'logeuclid'}, quantum=True, q_account_token=None, verbose=True, shots=1024, seed=None, upper_bound=7, regularization=None, classical_optimizer=None, qaoa_optimizer=None, create_mixer=None, n_reps=3, qaoa_initial_points=None, qaoacv_implementation=None)[source]