9.4 Quantum support vector machines in Qiskit
In the previous section, we mastered the use of QSVMs in PennyLane. You may want to review subsection 9.3.1 and the beginning of subsection 9.3.3. That is where we prepare the dataset that we will be using here too. In addition to running the code in those subsections, you will have to do the following import:
from sklearn.metrics import accuracy_score
Now it’s time for us to switch to Qiskit. In some ways, Qiskit can be easier to use than PennyLane — although this is probably a matter of taste. In addition, Qiskit will enable us to directly train and run our QSVM models using the real quantum computers available at IBM Quantum. Nevertheless, for now, let us begin with QSVMs on our beloved Qiskit Aer simulator.
9.4.1 QSVMs on Qiskit Aer
To get started, let us just import Qiskit:
from qiskit import *
When we defined a QSVM in PennyLane, we had to ”manually” implement a kernel function in order to pass it to...