Implementing of Variational Hybrid Quantum Classical Algorithm
Explore how to implement variational hybrid quantum-classical algorithms to classify data by transforming features into quantum states. Understand how feature weights and correlation coefficients influence survival predictions using quantum machine learning techniques.
The scores of the random quantum classifier
In line 2, we first create the statevector_simulator backend, which we can reuse for all our predictions.
We use the classifier_report wrapping function we
developed in the lesson Unmask the Hypocrite Classifier.
Besides an arbitrary name in the output in line 5, the primary input is the classifier we provide in line 6.
We provide an anonymous lambda function, which is a function without a name, as our classifier. It takes a single parameter passenger and runs, from inner to outer, the pre_process function with the passenger as a parameter. Finally, we put the result alongside the backend into the pqc a function whose result we put into the post_process function.
When we run the pqc classifier with the initial state, we can see that it yields identical scores as the random classifier.
Now, it’s finally time to build a real classifier, one that uses the actual passenger data to predict whether the passenger survived the Titanic shipwreck or not.
Let’s start at the end. The current post-processing already returns either 0 or 1. This fits our required output since 0 represents a passenger who died, and 1 represents ...