Conditional Probability · Bayes' Formula
Lesson 3
Let's give an example. We want to estimate the probability that an email is spam, given that it contains the word “Viagra.” We know the probability is high, but how can a spam filter understand this by simply accumulating statistics? Denote the events “being spam” and “containing the word 'Viagra”' as \(H\) and \(E\), respectively. Then \(\Pr[H]\) is the probability of an email being spam. We can estimate this probability based on all previously received emails: it is simply the proportion of spam emails among all received emails. \(\Pr[E]\) is the probability of an email containing the word “Viagra,” i.e., the proportion of all emails containing this word. Finally, \(\Pr[E \mid H]\) is the proportion of all spam emails that contain the word “Viagra,” among all spam emails.