贝叶斯分类

First Step

Find Classes:

      C1: buys_computer = ‘yes’

      C2: buys_computer = ‘no’

 

Second Step

      Find P(C1) and P(C2)

                      P( buys_computer = “yes”)  = 9/14 = 0.643

                    P( buys_computer = “no”) = 5/14= 0.357

 

Third Step

  Compute P (X|C) for each class :

     P (age = “Youth” / buys_computer = “yes”)  = 2/9 = 0.222

     P (age = “Youth” /  buys_computer = “no”) = 3/5 = 0.6

     P (income = “medium” /  buys_computer = “yes”) = 4/9 = 0.444

     P (income = “medium” /  buys_computer = “no”) = 2/5 = 0.4

     P (student = “yes” /  buys_computer = “yes) = 6/9 = 0.667

     P (student = “yes” /  buys_computer = “no”) = 1/5 = 0.2

     P (credit_rating = “fair” /  buys_computer = “yes”) = 6/9 = 0.667

     P (credit_rating = “fair” / buys_computer = “no”) = 2/5 = 0.4

 

Fourth Step .

    Find P(X|Ci) :

 For C1:    Multiply all the probabilities that belong to class “yes”

           P(X|buys_computer = “yes”) = 0.222 x 0.444 x 0.667 x 0.667=.044

Similarly     for “class = no”

          P(X|buys_computer = “no”) = 0.6 x 0.4 x 0.2 x 0.4 = 0.019

 

Finally ,

     find ……  P(X|Ci)*P(Ci) …….  for each class

P(X|buys_computer = “yes”) * P(buys_computer = “yes”) = 0.028

P(X|buys_computer = “no”) * P(buys_computer = “no”) = 0.007

 

参考:

http://www.cnblogs.com/phinecos/archive/2008/10/21/1315948.html

http://summerbell.javaeye.com/blog/392459

http://blog.csdn.net/DL88250/archive/2008/02/20/2108164.aspx

http://www.cnblogs.com/waemz/archive/2009/02/25/1397647.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值