Introduction

In our first simple variational hybrid quantum-classical binary classification algorithm, which we developed in the previous chapter, we used a parameterized quantum circuit (PQC) that measured a quantum state. While quantum systems bring inherent randomness and allow us to work with probabilities, we did not yet use this characteristic because we determined the resulting probability of measuring either 0 or 1 upfront in a classical program.

In the following two chapters, we go one step further. We create a probabilistic binary classifier that calculates the resulting likelihood inside the PQC. We build a variational hybrid quantum-classical Naïve Bayes classifier. It builds upon Bayes’ Theorem. Starting with an initial prior probability, we update the resulting probability inside the PQC based on the evidence given by the passenger data.

Don’t worry if you’re not familiar with Bayes’ Theorem and the Naïve Bayes classifier. We’ll cover all the basics in this chapter.

We use the Titanic shipwreck data to discover Bayes’ Theorem and the Naïve Bayes classifier with actual data. We load the original data here because it is easier to work with manually.

Get hands-on with 1200+ tech skills courses.