
This exercise builds a contingency table using a 1% prior for flu, and test-positive rates of 95% if infected and 10% if not infected.
Explore how prior information and conditional probabilities drive a Bayesian network built from cancellations data. Learn to assess conditional independence and estimate posterior probabilities.
Explore conditional probability and independence as you introduce an overarching problem that leads to the centerpiece of Bayes theorem.
Bayes' theorem to update the probability you have the flu given a positive test, starting from a 5% prior with 90% true positives and 50% false positives.
Apply law of total probability to compute the chance of sunny weather by conditioning on low or high temperatures, showing how twenty-one percent and eighteen percent sum to thirty-nine percent.
Explore absolute independence and conditional independence in probability, illustrated with run and weather examples, and clarify how conditioning on a third variable affects independence.
For the conditional to absolute independence exercise, compute the second value for the contingency table: the joint probability of John not running and Kate not running.
Explore how absolute independence does not imply conditional independence in a John and Kate running scenario, as conditioning on Kate's run and their meeting status shifts probabilities.
Explore the two key learnings: absolute independence does not imply conditional independence, and conditional independence does not imply absolute independence.
Explore how a bayesian network captures six variables: customer type, region, number of products, usage, price increase, and cancellation, and reduces conditional probability information compared with a full joint table.
Describe d-separation steps in a Bayesian network: list variables, trace parents, disorient the graph, remove observed nodes, and assess if type and region stay connected given price.
This lecture demonstrates d-separation in a simple Bayesian network with Jon and Kate; they are absolutely independent, but not conditionally independent given that they share a joint child.
Apply enumeration to compute the probability that John goes running and they do not meet, using conditional independence, a Bayesian network, and summing over temperature and Kate's running.
Calculate the denominator for the probability that John goes running given that they don't meet using the 42.25% joint and 38% non-meeting terms, then apply Bayes to obtain 52.6%.
Apply the enumeration approach to calculate the probability that Jon and Kate meet, given a higher temperature.
Master two methods for exact posterior probabilities in Bayesian statistics, network enumeration and elimination, and prefer elimination to reduce calculations while tackling the overarching problem.
Review probability, independence concepts, and Bayesian networks. Introduce d-separation and demonstrate calculating posterior probabilities using enumeration and elimination.
Investigate a Bayesian network from past cancellations in healthcare education software, testing independence and conditional probabilities among customer type, region, usage, price history, and contract cancellation.
Apply bayesian networks and bayes theorem to compute the probability of a customer from the north given observed factors, using elimination and conditional tables to reach about 22.23%.
Use Bayes' theorem to compute P(cancel|hospital) from joint probabilities, yielding about 25.14% for hospital patients.
Complete the mini project by applying all learned concepts in Bayesian statistics, and learn practical methods to estimate posterior probabilities in complex Bayesian networks.
Explore three sampling methods—rejection sampling, Gibbs sampling, and a version of the Metropolis-Hastings algorithm—using conditional probability tables to estimate the probability a customer cancels given origin in the north.
The python code for the rejection sampling simulation can be found below.
Explore rejection sampling by iterating rounds, drawing from conditional probabilities, and accepting or rejecting samples to estimate a conditional probability. Learn convergence criteria and note potential high rejection rates.
Discover Gibbs sampling in a bayesian network, using the Mackoff blanket to simplify conditional probabilities and iteratively update variables to approximate the target probability.
The python code for the Gibbs sampling simulation can be found below.
The python code for the Metropolis-Hastings sampling simulation can be found below.
This lecture formalizes the Metropolis-Hastings algorithm, using a uniform proposal over other variables, calculating an acceptance ratio from current and proposed probabilities, and iterating to infer conditional probabilities.
Contrast the Bayesian view of probability, which assigns degrees of belief, with the frequentist view, which relies on long-term frequencies for repeatable events.
Explore frequentist hypothesis testing with 20 flips, testing H0: p=0.5 against p>0.5 by the binomial distribution to compute P(X≥14) ≈ 5.77%, yielding a fail-to-reject decision at 5%.
Combine priors with the data to form posterior probabilities for the true hit probability, given 14/20. Highlight p=0.7 as the posterior mode and leading estimate.
Compare frequentist hypothesis testing with Bayesian inference using a coin toss example: 14/20 heads, null probability 0.5, prior distribution, posterior probabilities, and predicting the next flip.
Let us assume that there are only three colors that a person can in principle choose from: blue, yellow and green.
Compare discrete priors for the true heads probability with a continuous uniform prior on [0,1], and outline obtaining the posterior for p from 14/20 trials using Bayes' rule.
Using a beta(1,1) prior and binomial(20, p) data with 14 successes, the posterior for p is beta(15,7).
The python code for the rejection sampling simulation can be found below.
The python code for the Metropolis-Hastings sampling simulation can be found below.
This lecture compares rejection sampling and Metropolis-Hastings to the exact posterior, showing MH converges quickly after about 1k iterations, while rejection sampling remains slower due to a rare event.
Explore how to sample from a normal distribution conditioned on being greater than two by implementing rejection sampling and the Metropolis Hastings algorithm, and discuss which algorithm to use.
Explore how patient statistics relate to machine learning, showing their role in supervised and unsupervised learning within the latest section of the course.
Develop conditional probability tables for region given customer cancellation outcomes, and apply Laplacian smoothing to handle unseen regions.
The procedure of iteratively calculating responsibilities and updating the distribution parameters is called Expectation-Maximization. For further details, please refer to the resources below.
Bayesian Statistics is a fascinating field and today the centerpiece of many statistical applications in data science and machine learning. In this course, we will cover the main concepts of Bayesian Statistics including among others Bayes Theorem, Bayesian networks, Enumeration & Elimination for inference in such networks, sampling methods such as Gibbs sampling and the Metropolis-Hastings algorithm, Bayesian inference and the relation to machine learning.
This course is designed around examples and exercises that provide plenty of opportunities to build intuition and apply your gathered knowledge. Many examples come from real-world applications in science, business or engineering or are taken from data science job interviews.
While this is not a programming course, I have included multiple references to programming resources relevant to Bayesian statistics. The course is specifically designed for students without many years of formal mathematical education. The only prerequisite is high-school level mathematics, ideally a first-year university mathematics course and a basic understanding of probability.