Search⌘ K

Calculating the Marginal Probability and Log-likelihood

Understand how to calculate marginal probabilities and log-likelihood scores using Bayesian inference with quantum networks. This lesson guides you through filtering states, computing probabilities for different variables, and interpreting log-likelihood values to evaluate and enhance your Bayesian model.

Calculating the marginal probability to survive

Javascript (babel-node)
def sum_states(states):
return sum(map(lambda item: item[1], states))
print(sum_states(filter_states(results.items(), QPOS_SURV, '1')))

We use the map function only to keep the probability of each tuple (map(lambda item: item[1])) and return the sum of all these values.

As we see, the probability of surviving is the value we expect (0.380.38), but ...