Marginal

Probabilistic Models & Causality

Structured probability and cause and effect: conditional independence, Bayesian networks and d-separation, exact inference, Markov random fields and Gibbs distributions, latent variables and the EM algorithm, variational inference and the evidence lower bound, causal graphs and interventions, the backdoor adjustment and counterfactuals.

21 lessons in 3 units

Start your free trial14 days free. No card needed.
What you'll learn

21 lessons, one small step at a time

Each lesson states its goal, then works up to it in short steps with practice after each. A placement test at the start skips what you already know.

Graphical Models

9 lessons
  1. Independence given a causeCompute joint probabilities of effects that are independent given their cause, and their probabilities averaged over the cause.
  2. Conditional independenceCompute the marginal probabilities of two effects of a common cause, show that the effects are dependent overall, and test conditional independence from a table.
  3. Factorizing a jointFactor the joint distribution of a Bayesian network into one local factor per variable, and compute the probability of a full assignment.
  4. Parameters of Bayesian networksRead conditional probability tables to compute the probability of a full assignment, and count the parameters a network needs.
  5. Chains & forksCompute how information flows along a chain, and tell when conditioning on the middle node blocks a chain or a fork.
  6. Colliders & explaining awayShow how observing a common effect makes its independent causes dependent, compute the size of that effect, and recognize selection on a collider.
  7. d-separationTell whether a path through each three-node pattern is open or blocked, and read independences off longer graphs with d-separation.
  8. Potentials & energiesCompute the energy of a configuration of an undirected model, and the ratio of two configurations' probabilities.
  9. Markov random fieldsCompute the partition function of a small Markov random field, and read its independences from the graph.

Inference & Learning

6 lessons
  1. MarginalizingCompute the probability of an observed effect by summing over the scenarios for its unobserved causes, and order the sums efficiently.
  2. Inference in Bayesian networksCompute the posterior probability of a cause given an observed effect, and how it changes when another cause is confirmed.
  3. Mixture modelsCompute the probability of data under each component of a mixture, and under the whole mixture by summing over the hidden component.
  4. Latent variables & EMRun the EM algorithm on a mixture: compute responsibilities, then re-estimate the mixing weights and the component parameters.
  5. The evidence lower boundCompute the evidence and the evidence lower bound of a latent-variable model, and explain EM as coordinate ascent on the bound.
  6. Variational inferenceCompute the KL gap between the ELBO and the log evidence, find the optimal approximation, and explain why mean field underestimates uncertainty.

Causality

6 lessons
  1. Seeing vs. doingCompute an outcome's probability when a variable is observed and when it is set by intervention, and explain why the two differ.
  2. Causal graphs & interventionsCut a causal graph for an intervention, compute interventional probabilities by truncated factorization, and tell when seeing equals doing.
  3. The backdoor adjustmentFind the sets that satisfy the backdoor criterion, and compute a causal effect with the adjustment formula.
  4. The front-door adjustmentCompute a causal effect through a mediator with the front-door adjustment, and tell when it applies.
  5. Simpson's paradoxCompute a reversal between pooled and stratified comparisons, and use the causal graph to decide which comparison to trust.
  6. CounterfactualsCompute a counterfactual in a structural causal model by abduction, action and prediction.
Sample lesson

Independence given a cause

Goal: Compute joint probabilities of effects that are independent given their cause, and their probabilities averaged over the cause.

A joint distribution over many variables is hopeless to write down directly: 30 binary variables need a billion probabilities. Structure saves us, and the key structural idea is conditional independence: once you know a common cause, its effects carry no further information about each other.

We will multiply given the cause and finish with averaging over the cause.

Step 1: Independent given the cause

X and Y are conditionally independent given Z, written X ⊥ Y | Z, if once Z is known their probabilities multiply:

P(x, y | z) = P(x | z)·P(y | z) for all x, y, z

Two tests for the same disease D are typically independent given the disease: each errs for its own reasons, so among people known to have D, A's result says nothing more about B, and the same holds among people known not to have D. If both tests detect the disease with probability 0.9, a sick person tests positive on both with probability 0.81. This is not independence in the whole population, and neither test causes the other.

Step 2: Averaging over the cause

Unconditionally, condition on Z and add up over its values:

P(x, y) = Σz P(z)·P(x | z)·P(y | z)

Thinking in counts helps. With prevalence 0.2 and tests positive with probabilities 0.9 and 0.8 when D is present and 0.1 and 0.2 when it is absent: out of 1,000 people, 200 are sick, and 200 × 0.9 × 0.8 = 144 of them test positive on both; of the 800 healthy, 800 × 0.1 × 0.2 = 16 do. So 160 people, a share 0.16, are positive on both.

In the app, each step ends with practice questions, new ones every time, and the lesson comes back later in spaced reviews.

Start Probabilistic Models & Causality

Lessons that need something you haven't learned yet bring it in first, from any course.

Start your free trial14 days free. No card needed.