...

/

Calculating the Marginal Probability and Log-likelihood

Calculating the Marginal Probability and Log-likelihood

Learn how to calculate the marginal probability and log-likelihood.

Calculating the marginal probability to survive

Press + to interact
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 ...