5 hidden checks
Three small functions that turn this unit's formulas into code.
posterior(prior, sensitivity, fpr): the probability of having the condition given a positive test.prioris the prevalence,sensitivityis ,fpris .gaussian_mle(x): return(mu, sigma), the maximum likelihood estimates for a 1-D array of samples. MLE divides by .bernoulli_nll(p, flips): the negative log-likelihood of an array of 0/1flipsunder probabilitypof a 1. Usenp.log.
- posterior reproduces the lesson's examplenot run
- posterior handles other casesnot run
- gaussian_mle returns the mean and the divide-by-n spreadnot run
- bernoulli_nll is the sum of -log probabilitiesnot run
- the NLL is smallest at the observed fractionnot run