Calculating the Posterior Probability
Explore how to calculate posterior probabilities within a quantum naive Bayes classifier using controlled rotation gates and auxiliary qubits. Understand techniques for modifying target qubit probabilities with modifiers above and below one, and learn how to implement these calculations in parameterized quantum circuits to accurately represent posterior states.
We'll cover the following...
- Calculating the posterior probability for a modifier smaller than 1.0
- Calculating the posterior probability for a modifier greater than 1.0
- Refilling the aux_full qubit
- Including the measurement into the circuit
- Calculating the posterior of a female passenger with a first class ticket
- The parameterized quantum circuit
We use the controlled -gate to calculate the posterior probability.
Calculating the posterior probability for a modifier smaller than 1.0
If the modifier is below in the code block after line 6, we need to reduce the target probability by a portion of in line 8. The target qubit acts as the control qubit. In states when the target qubit is 1, we separate a part of 1−modifier and set the controlled qubit to 1. The controlled qubit has the index step*2. The for step is 0, and the index of this qubit is 0, too. This qubit acts as a trunk. We do not work with it anymore.
The controlled rotation does not change the value of the control qubit. Thus, the target-qubit is 1 in both parts. The following CNOT-gate in ...