Stop 02 · Math FoundationsTopics · 7/9

Bayesian Thinking Basics

Part of the Data Science Roadmap

In short

You already update your beliefs when new clues arrive. Bayesian thinking just does it with numbers, and it stops you from overreacting to one scary test result.

Updating your belief about something as new evidence arrives, using Bayes' theorem — a mindset (not just a formula) that's especially useful for reasoning about model confidence and rare events.

The mascot stands at a doorway holding a folded umbrella and looks up at dark clouds.

Think of it like this

Taking an umbrella in July

Before stepping out, you think there's maybe a 30% chance of rain. Then you see dark clouds rolling in. You don't throw away your first guess, you raise it. Your starting belief plus new evidence gives an updated belief.

Watch it happen

A positive test, read the Bayesian way

Prior
Evidence
Likelihood
Posterior

1/5Prior: only 1% of people have this disease before any test.

The big ideas

What you need to know

Start with a prior

Your belief before new data. Base rates, like how common something is, matter a lot.

Weigh the evidence

Ask how likely this evidence would be if your idea were true, and if it were false.

Update, don't replace

The posterior blends prior and evidence. Strong evidence moves it more; weak evidence moves it a little.

It's everywhere

Spam filters, A/B test analysis and medical diagnosis all use this kind of updating.

See it in code

Walk through the code

python
1prior = 0.01          # 1% of people have the disease2sensitivity = 0.95    # P(positive | disease)3false_pos = 0.05      # P(positive | no disease)4 5p_positive = sensitivity * prior + false_pos * (1 - prior)6posterior = sensitivity * prior / p_positive7print(round(posterior, 3))   # 0.161

1/3The base rate and how the test behaves for sick and healthy people.

Bayes' rule in three lines. A 95% accurate test still gives only a 16% chance when the disease is rare.

Save yourself the pain

Common mistakes

Oops

Ignoring the base rate and trusting the test accuracy alone.

Do this instead

Always ask how common the thing is to begin with. Rare events produce many false alarms.

Oops

Treating your prior as fixed forever.

Do this instead

Each new piece of evidence turns today's posterior into tomorrow's prior.

Your mission

Play with the base rate

~15 min

Quick check

A fraud alert flags 2% of all payments, and real fraud is 0.1% of payments. What's true about most flagged payments?

Go deeper

  1. 1Work through a classic Bayesian update example (like the medical test false-positive problem).
  2. 2Learn the difference between a prior, a likelihood, and a posterior in plain language.
  3. 3Practice updating a belief step by step as you're given new pieces of evidence.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge