10 – SL NB 09 Bayesian Learning 3 V1 V4

So, let’s do this calculation a bit more in detail. Since we have eight emails in total and three of them are spam and five of them are non-spam or ham, then our prior probabilities are three over eight for spam and five over eight for ham. So, onto calculate the posteriors. Say we have a spam email, since there are three of them and one contains the word easy and two don’t. Then, the probability for containing the word easy is one-third, and for not containing it is two-thirds, if you’re spam. And as we had calculated before, the probability of containing the easy if your ham is one-fifth and of not containing it if your ham is four-fifths. Now, by the rule of conditional probability, probability of the email spam containing the word easy is the product of these two, three over eight times one-third, which one-eighth. In a similar way, we calculate the probability of being spam and not containing the word easy, which is one-fourth. And probabilities of being ham containing the word easy is one-eighth, and not containing it is one-half. Now, this is where we apply Bayes’ rule. We know that the email contains the word easy, so our entire universe consists of only these two cases: when the is spam or ham. Those two have the same probability, one-eighth of happening. So, once we normalize the probabilities, they both turn into 50 percent. Thus, our two posterior probabilities are 50 percent. For ham emails, we can do the same procedure. Our prior are three over eight and five over eight as before. Our probabilities of containing the word money and not containing it are two-thirds and one-third for the spam emails, and one-fifth and four-fifths for the ham emails. Our products of probabilities are then one-quarter, one-quarter, one-eighth, and one-half. But since the email contains the word money, then we only care about these two. Since one-fourth is twice as much as one-eighth, when we normalize them we get two-thirds or 66.7 percent for spam, and one-third or 33.3 percent for ham. These are the posteriors.

Dr. Serendipity에서 더 알아보기

지금 구독하여 계속 읽고 전체 아카이브에 액세스하세요.

Continue reading