Machine Learning [3] Naive Bayes Classification

Source: Internet
Author: User

Outlook Temperature Humidity Windy Play
  Yes No   Yes No   Yes No   Yes No Yes No
Sunny 2 3 Hot 2 2 High 3 4 False 6 2 9 5
Overcast 4 0 Mild 4 2 Normal 6 1 Trur 3 3    
Rainy 3 2 Cool 3 1                
As shown in the above table, we will calculate whether to play when the conditions are sunny, cool, high, and true. Of course, the decision tree can also be used. This section uses Naive Bayes to solve the problem.

 

B1, B2.... bn

First, let's take a look at the Bayesian formula. The probability of occurrence of a under B, that is, the probability that Sunny, cool, high, true is equal to yes, and the probability that it is equal to no, are all calculated, compare the size, which is big, and which is the result.

P (Yes | all) = P (all | yes) P (yes)/P (all) = P (Sunny | yes) P (cool | yes) P (high | yes) P (true | yes) P (yes)/P (all)

= 2/9*3/9*3/9*3/9*9/14/P (all) = 0.005/P (all)

P (no | all) = P (all | no) P (NO)/P (all) = P (Sunny | no) P (cool | No) P (high | no) P (true | no) P (NO)/P (all)

= 3/5*1/5*4/5*3/5*5/14/P (all) = 0.021/P (all)

Therefore, the probability of no is high. Therefore, sunny, cool, high, and true should not play the game.



Note that the table has a data value of 0, which means that when Outlook is overcast, if you do not play the ball or the probability is 0, you must play the ball as long as it is overcast, this violates the basic assumption of Naive Bayes that output depends on all attributes.












Machine Learning [3] Naive Bayes Classification

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.