Understanding Bayes theorem with conditional probability

Conditional probability provides a way of calculating relationships between dependent events using Bayes theorem. For example, A and B are two events and we would like to calculate P(AB) can be read as the probability of an event occurring A given the fact that event B already occurred, in fact, this is known as conditional probability, the equation can be written as follows:

To understand better, we will now talk about the email classification example. Our objective is to predict whether an email is a spam given the word lottery and some other clues. In this case, we already knew the overall probability of spam, which is 10 percent also known as prior probability. Now suppose you have obtained an additional piece of information that probability of word lottery in all messages, which is 4 percent, also known as marginal likelihood. Now, we know the probability that lottery was used in previous spam messages and is called the likelihood.

By applying the Bayes theorem to the evidence, we can calculate the posterior probability that calculates the probability that the message is how likely a spam; given the fact that lottery was appearing in the message. On average if the probability is greater than 50 percent it indicates that the message is spam rather than ham.

In the previous table, the sample frequency table that records the number of times Lottery appeared in spam and ham messages and its respective likelihood has been shown. Likelihood table reveals that P(LotterySpam)= 3/22 = 0.13, indicating that probability is 13 percent that a spam message contains the term Lottery. Subsequently we can calculate the P(Spam ∩ Lottery) = P(LotterySpam) * P(Spam) = (3/22) * (22/100) = 0.03. In order to calculate the posterior probability, we divide P(Spam ∩ Lottery) with P(Lottery), which means (3/22)*(22/100) / (4/100) = 0.75. Therefore, the probability is 75 percent that a message is spam, given that message contains the word Lottery. Hence, don't believe in quick fortune guys!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset