Probability: Keep the Population Visible

1 / 6

A table before a formula

  • 1,000 messages: 100 spam, 900 ordinary.
  • Flags: 80 spam + 180 ordinary = 260.
  • Joint spam-and-flag = 80/1,000; spam given flag = 80/260.
2 / 6

Derive evidence

  • P(flag) = 0.8×0.1 + 0.2×0.9 = 0.26.
  • Posterior = 0.08/0.26 = 4/13.
  • Reverse conditional P(flag|spam)=0.8 answers another question.
3 / 6

Check independence

  • Product of marginals: 0.1×0.26=0.026, not joint 0.08.
  • joint_probability assumes independence; it cannot prove it.
  • Given at least one head in two fair flips: HH, HT, TH remain.
4 / 6

Match the API

  • Compute evidence with total_probability first.
  • bayes_theorem(likelihood, prior, evidence).
  • bayesian_update(prior, likelihood, evidence) changes argument order.
  • Zero denominator returns 0 by policy; the mathematical ratio is undefined.
5 / 6

Predict before revealing

  • Change spam prevalence to 0.25; keep detector rates fixed.
  • Calculate both joint contributions, evidence, and posterior.
  • Check the lesson's reveal, then reconstruct a fresh 200-message table.
6 / 6
←/→ or click edges to navigate · ? help · N notes · F fullscreen