Variational Hybrid Quantum Classical Algorithm

Get introduced to the concept of a variational hybrid quantum classical algorithm.

The PQC binary classifier we created in the previous lesson, Parameterized Quantum Circuit, is as good as the random classifier—or as poor, because it does not increase the information level.

This is going to change now. So far, we’ve fed the PQC with the same initial state, ψ=[1212]|\psi\rangle=\begin{bmatrix}\frac{1}{\sqrt{2}}\\\frac{1}{\sqrt{2}}\end{bmatrix}, with the corresponding array in Python: [1/sqrt(2), 1/sqrt(2)].

This state does not take into account the passenger data at all. It is a hypocritical classifier, such as the classifiers we build in the lesson Unmask the Hypocrite Classifier. Hypocrite classifiers solely use chance when predicting the label of a thing. While such a classifier can yield seemingly good performance in a single metric, such as precision, it does not reach an average above 0.5 for the four metrics directly resulting from the confusion matrix, which are precision, recall, specificity, and NPV. Thus, it does not provide any information gain.

To improve our classifier, we need to use the passenger data. However, while we prepared the passenger data into normalized numerical data, it doesn’t fit the quantum state vector we need to feed into our PQC. Therefore, we need to pre-process our passenger data for it to be computable by a quantum computer.

We implicitly post-processed the results as part of the return statement, as shown in the following snippet.

Get hands-on with 1400+ tech skills courses.