Download presentation
Presentation is loading. Please wait.
1
The Naive Bayes Classifier Application to Text Classification Example: spam filtering Kunstmatige Intelligentie / RuG Marius Bulacu
2
2 Bayes Formula Posterior probability of the class after seeing the data Prior probability of the class before seeing anything Unconditional probability of the data Conditional Likelihood of the data given the class
3
3 Medical example p(+disease) = 0.002 p(+test | +disease) = 0.97 p(+test | -disease) = 0.04 p(+disease | +test) = p(+test | +disease) * p(+disease) / p(+test) = 0.97 * 0.002 / 0.04186 = 0.00194 / 0.04186 = 0.046 p(-disease | +test) = p(+test | -disease) * p(-disease) / p(+test) = 0.04 * 0.998 / 0.04186 = 0.03992 / 0.04186 = 0.953 p(+test) = p(+test | +disease) * p(+disease) + p(+test | -disease) * p(-disease) = 0.97 * 0.002 + 0.04 * 0.97 = 0.00194 + 0.03992 = 0.04186
4
4 Accumulation of evidence “naive” assumption that X and Y are independent
5
5 Spam filtering From acd@essex.ac.uk Mon Nov 10 19:23:44 2003 Return-Path: Received: from serlinux15.essex.ac.uk (serlinux15.essex.ac.uk [155.245.48.17]) by tcw2.ppsw.rug.nl (8.12.8/8.12.8) with ESMTP id hAAIecHC008727; Mon, 10 Nov 2003 19:40:38 +0100 Apologies for multiple postings. > 2nd C a l l f o r P a p e r s > > DAS 2004 > > Sixth IAPR International Workshop on > Document Analysis Systems > > September 8-10, 2004 > > Florence, Italy > > http://www.dsi.unifi.it/DAS04 > > Note: > There are two main additions with respect to the previous CFP: > 1) DAS&DL data are now available on the workshop web site > 2) Proceedings will be published by Springer Verlag in LNCS series Example of regular mail:
6
6 Spam filtering Example of spam: From : Easy Qualify" To : bulacu@hotmail.com Subject : Claim your Unsecured Platinum Card - 75OO dollar limit Date : Tue, 28 Oct 2003 17:12:07 -0400 ================================================== mbulacu - Tuesday, Oct 28, 2003 ================================================== Congratulations, you have been selected for an Unsecured Platinum Credit Card / $7500 starting credit limit. This offer is valid even if you've had past credit problems or even no credit history. Now you can receive a $7,500 unsecured Platinum Credit Card that can help build your credit. And to help get your card to you sooner, we have been authorized to waive any employment or credit verification.
7
7
8
8 Learning to classify e-mail Target concept Spam?: e-mail --> {-,+} Each word represents an attribute characterizing the e-mail Estimate p(+spam) and p(-spam) from the training data as well as the conditional likelihoods for all the encountered words For a new e-mail, assuming naive Bayes conditional independence, compute the MAP hypothesis
9
9 Conclusions Effective: about 90% correct classification Could be applied to any text classification problem Needs to be polished
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.