Pre-Processing
Understand the preprocessing steps in the Quantum Naive Bayes classifier by learning how to calculate ticket class and gender modifiers from passenger data. Discover how these modifiers adjust prior probabilities for better classification results within a quantum machine learning context.
We'll cover the following...
The pre-processing covers the calculation of the modifiers. We start with the ticket class.
Calculating the ticket class modifier
We define a function that takes the passenger’s pclass as input. The Pclass column in our dataset is the ticket class (1 = 1st, 2 = 2nd, 3 = 3rd).
We calculate the backward probability by dividing the passengers who survived having the given ticket class (cnt_surv_pclass) in line 4 by all survivors (cnt_survivors) in line 7. Then, we calculate the probability of a passenger owning the given ticket class. The number of passengers with the given ticket class is divided by the total number of passengers in line 10.
The modifier is the evidence’s backward probability divided by the likelihood to see the evidence. For the given ticket class, the modifier is ...