liveBook · Manning

Conditional probability

As explained in Grokking Machine Learning

The probability of an event given that another event or condition is known to occur.

Conditional probability is the probability of an event when another event is known to have occurred. The notation P(A|B) means “the probability of A given B.” For example, P(rain today | living in the Amazon) = 0.8 means an 80% chance of rain under that condition. section 1.1

Spam and the word “lottery”

In a dataset of 100 emails, 20 are spam. Among the 20 emails containing “lottery,” 15 are spam, so the probability an email is spam given that it contains “lottery” is 15/20 = 0.75. The condition changes the estimate from the overall spam probability of 0.2. section 8.2

Figure 8.7 From the previous tree, we have removed the two branches where the emails don’t contain the word lottery. Out of the original 100 emails, we have 20 left that contain lottery. Because of these 20 emails, 15 are spam, we conclude that the probability that an email is spam given that it contains the word  lottery is 0.75.

Follow the probability tree as emails without “lottery” are removed, leaving the conditional group. section 8.2

How Grokking Machine Learning covers it

How deep it goes
Defines the notation and works through email counts and a probability tree, without deriving a general formula.
Examples
Illustrates the idea with rain in the Amazon and spam emails containing “lottery.”
What you can do after
Evaluate how known evidence changes an event estimate and interpret conditional-probability notation in simple examples.
How it connects
Connects conditional probability to Bayes’ theorem, naive Bayes, classification, complementary probabilities, and event intersections.

Also explained in

Compare how 11 books explain conditional probability →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning. The section links point to the parts of the book it draws on.