Circuit Implementation
Learn how we can implement circuits and define the CCRY-gate.
We start with implementing our example thus far, which was to determine the effect the Sex
of a passenger and being a child (isChild
) had on the Survival
of the Titanic shipwreck.
A qubit represents each node in the Bayesian network. Since all our nodes in this dataset are presented as binary (Sex
, isChild
, Survival
), a single qubit each will be sufficient. If we had more discrete states or a continuous distribution, we would need more qubits. The qubit states represent the marginal (for root nodes) and the conditional (for Survival
node) probability amplitudes of the corresponding variables.
The state represents a male passenger or an adult. The state represents a female or a child. The superposition of the qubit denotes the probability of either state.
We initialize these two qubits through rotations around the Y-axis.
Get hands-on with 1200+ tech skills courses.