18.3 Conditional probability
In the previous sections, we learned the foundations of probability. Now we can speak in terms of outcomes, events, and chances. However, in real-life applications, these basic tools are not enough to build useful predictive models.
To illustrate this, let’s build a probabilistic spam filter! For every email we receive, we want to estimate the probability P(email is spam). The closer this is to 1, the more likely that we are looking at a spam email.
Based on our inbox, we might calculate the relative frequency of spam emails and obtain that
However, this doesn’t help us at all. Based on this, we can randomly discard every email with probability P(email is spam), but that would be a horrible spam filter.
To improve, we need to dig a bit deeper. When analyzing spam emails, we start to notice patterns. For instance, the phrase “act now” can be found almost exclusively in spam. After a quick count, we get that
This looks much...