Create Presentation
Download Presentation

Download

Download Presentation

The Naive Bayes Classifier Application to Text Classification Example: spam filtering

218 Views
Download Presentation

Download Presentation
## The Naive Bayes Classifier Application to Text Classification Example: spam filtering

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**The Naive Bayes Classifier**Application to Text Classification Example: spam filtering Marius Bulacu Kunstmatige Intelligentie / RuG**Bayes Formula**Conditional Likelihood of the data given the class Prior probability of the class before seeing anything Posterior probability of the class after seeing the data Unconditional probability of the data**Medical example**p(+disease) = 0.002 p(+test | +disease) = 0.97 p(+test | -disease) = 0.04 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 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**“naive” assumption that**X and Y are independent Accumulation of evidence**Spam filtering**Example of regular mail: From acd@essex.ac.uk Mon Nov 10 19:23:44 2003Return-Path: <alan@essex.ac.uk>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**Spam filtering**Example of spam: From : Easy Qualify" <mbulacu@netaccessproviders.net>To : bulacu@hotmail.comSubject : Claim your Unsecured Platinum Card - 75OO dollar limitDate : 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 evenno 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.**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**Conclusions**• Effective: about 90% correct classification • Could be applied to any text classification problem • Needs to be polished