TNO Quantum provides generic software components aimed at facilitating the development of quantum applications.
This package implements a scikit-learn compatible, (quantum) support vector machine.
During the fit, the (quantum) support vector machine solves a discretized version of the continuous optimization problem posed by a standard kernel support vector machine. This discrete optimization problem can be solved using quantum optimization algorithms (DWAVE, QAOA, etc.). Predictions are done classically based on the solutions found during fit.
An earlier version of the SVM was used in the following publication:
Limitations in (end-)use: the content of this software package may solely be used for applications that comply with international export control laws.
Documentation of the tno.quantum.ml.classifiers.svm package can be found here.
Easily install the tno.quantum.ml.classifiers.svm package using pip:
$ python -m pip install tno.quantum.ml.classifiers.svmThe Support Vector Machine can be used as shown in the following example.
-
Note: This example requires
tno.quantum.optimization.solvers[dwave]andtno.quantum.ml.datasetswhich can be installed along the package using:$ python -m pip install tno.quantum.ml.clustering.kmedoids[example]
from tno.quantum.ml.classifiers.svm import SupportVectorMachine
from tno.quantum.ml.datasets import get_iris_dataset
X_training, y_training, X_validation, y_validation = get_iris_dataset(n_classes=2)
svm = SupportVectorMachine()
svm = svm.fit(X_training, y_training)
predictions_validation = svm.predict(X_validation)