Multinomial naive bayes classifier

LAB 4

Multinomial naive bayes classifier to predict spam SMS.WE implement a unigram model here

1.we need to caculate following

which is the probility of class_i occur in all document , in this case we have two class ,one is spam and another is ham

2.this is the likelihood of that word given a class ,

w represent word , c represent class

count(w,c) is the total number of that word occur in that class

count ( c ) is the total number of word in that class

we also use add-1 smoothing in this case , the purpose is that we aviod the 0 appear in the probility in the every single word by add 1 in the Numerator and add V which is the total number of set(all wrods) to the denominator,althongh the word not occur in the vacabulary ,the probility will not assign 0

in this case

3.this is priors

Caculate the Conditional Probilities

By implement the equition in 2 , calculate the P(word|class) of all the word in the sms both in spam and ham ,after that we are able to caculate the likelihood of P(class ham|sms) and P(class spam|sms)

which is

i : every word in the sms

and using same equition in spam ,after that caculating the ratio and all good to go (:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

昳昳昳昳阳_Yiyang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值