Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some small improvements to the comments #38

Merged
merged 8 commits into from
Mar 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions pyriemann_qiskit/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class QuanticClassifierBase(BaseEstimator, ClassifierMixin):
Difference between simulated and real quantum computer will be that:

* there is no noise on a simulated quantum computer
(so results are better);
* real quantum computer are quicker than simulator;
* real quantum computer tasks are assigned to a queue
before being executed on a back-end.
(so results are better)
* a real quantum computer is quicker than a quantum simulator
* tasks on a real quantum computer are assigned to a queue
before being executed on a back-end (delayed execution)

WARNING: At the moment this implementation only supports binary
classification.
Expand Down Expand Up @@ -129,7 +129,7 @@ def _map_0_1_to_classes(self, y):
return y_copy

def fit(self, X, y):
"""Get a quantum backend and fit the training data.
"""Uses a quantum backend and fits the training data.

Parameters
----------
Expand All @@ -142,7 +142,7 @@ def fit(self, X, y):
Raises
------
Exception
Raised if the number of classes is different than 2
Raised if the number of classes is different from 2

Returns
-------
Expand Down Expand Up @@ -201,7 +201,7 @@ def _train(self, X, y):
self._classifier.train(X, y)

def score(self, X, y):
"""Return the testing accuracy.
"""Returns the testing accuracy.
You might want to use a different metric by using sklearn
cross_val_score

Expand Down Expand Up @@ -238,7 +238,7 @@ class QuanticSVM(QuanticClassifierBase):
"""Quantum-enhanced SVM classification.

This class implements SVC [1]_ on a quantum machine [2]_.
Note if `quantum` parameter is set to `False`
Note that if `quantum` parameter is set to `False`
then a classical SVC will be perfomed instead.

Notes
Expand Down Expand Up @@ -287,8 +287,8 @@ def _init_algo(self, n_features):
def predict_proba(self, X):
"""This method is implemented for compatibility purpose
as SVM prediction probabilities are not available.
This method assigns to each trial a boolean which value
depends on wheter the label was assigned to classes 0 or 1
This method assigns a boolean value to each trial which
depends on whether the label was assigned to class 0 or 1

Parameters
----------
Expand All @@ -308,7 +308,7 @@ def predict_proba(self, X):
return np.array(ret)

def predict(self, X):
"""get the predictions.
"""Calculates the predictions.

Parameters
----------
Expand All @@ -329,8 +329,8 @@ class QuanticVQC(QuanticClassifierBase):

"""Variational Quantum Classifier

Note there is no classical version of this algorithm.
This will always run on a quantum computer (simulated or not)
Note that there is no classical version of this algorithm.
This will always run on a quantum computer (simulated or not).

Parameters
----------
Expand Down Expand Up @@ -389,7 +389,7 @@ def _init_algo(self, n_features):
return vqc

def predict_proba(self, X):
"""Return the probabilities associated with predictions.
"""Returns the probabilities associated with predictions.

Parameters
----------
Expand All @@ -407,7 +407,7 @@ def predict_proba(self, X):
return proba

def predict(self, X):
"""get the predictions.
"""Calculates the predictions.

Parameters
----------
Expand All @@ -428,16 +428,16 @@ class QuantumClassifierWithDefaultRiemannianPipeline(BaseEstimator,
ClassifierMixin,
TransformerMixin):

"""Default pipeline wiht riemann geometry and quantum classifiers.
"""Default pipeline with Riemann Geometry and a quantum classifier.

Project the data into the tangent space of the Riemannian manifold,
before applying quantum classification.
Projects the data into the tangent space of the Riemannian manifold
and applies quantum classification.

The type of quantum classification (quantum SVM or VQC) depends on
the value of the parameters.

Data are entangled using a ZZFeatureMap. A SPSA optimizer and a two-local
circuirt are used in addition for VQC.
circuits are used in addition when the VQC is selected.



Expand Down