Ask Claude about this

Combining Probabilities: Law of Total Probability

What is it? Finding Overall Chance by Breaking it Down

Sometimes, we want to find the overall probability of an event (let's call it Event A), but Event A can happen in different ways, depending on other situations or categories.

The Law of Total Probability is a rule that helps us calculate this overall probability. It works if we can divide all possibilities into a set of mutually exclusive categories that cover everything (this is called a "partition"). Let's say these categories are B₁, B₂, B₃, and so on.

The law states that the total probability of Event A is found by:

  1. Figuring out the chance of Event A happening within each category Bi (this is a conditional probability, P(A | Bi)).
  2. Knowing the chance of each category Bi itself occurring (P(Bi)).
  3. Multiplying these two for each category: P(A | Bi) × P(Bi). This gives the portion of A's probability that comes through category Bi.
  4. Adding up these portions from all the categories.

The formula looks like this:

P(A) = P(A | B₁) * P(B₁) + P(A | B₂) * P(B₂) + ... + P(A | Bn) * P(Bn)

Or more compactly: P(A) = Σ P(A | Bi) * P(Bi)

Think of it like finding a weighted average of the chances of A, where the weights are the chances of each category occurring.

When is this useful? Example: Netflix Raters

This law is very handy when the main event we're interested in (like a movie being rated "good") can happen through different "pathways" or types of people. In our Netflix example:

  • A movie can be rated "good" by a "careful" rater.
  • A movie can also be rated "good" by a "lazy" rater.

"Careful" and "Lazy" are our categories (B₁ and B₂). They are mutually exclusive (a rater is one or the other for a given rating) and they cover all raters.

If we know:

  • What percentage of raters are "careful" (P(Careful)).
  • What percentage of raters are "lazy" (P(Lazy)).
  • How likely a "careful" rater is to rate a movie "good" (P(Good | Careful)).
  • How likely a "lazy" rater is to rate a movie "good" (P(Good | Lazy)).

Then we can combine these pieces of information using the Law of Total Probability to find the overall chance that any randomly picked movie rating is "good".

Netflix Movie Raters

MODERATE

Netflix has hired people to rate movies. Out of all of the raters, 80% of the raters are "careful" and rate 60% of the movies they watch as "good" and 40% as "bad". The other 20% of raters are "lazy" and rate 100% of the movies they watch as "good".

Assuming all raters rate approximately the same number of unique movies (or a movie is randomly assigned to a rater), what is the overall probability that a movie is rated "good"?

Bayes' Twist: If a movie is randomly selected and found to be rated "good", what is the probability that it was rated by a lazy rater? (Hint: You'll need Bayes' Theorem for this: P(L | G) = [P(G | L) * P(L)] / P(G). You just calculated P(G)!).

Nerchuko Academy · Free DS Interview Prep