2. Baye's Theorem
๏ฝ Bayes' Theorem is named after Thomas Bayes.There are
two types of probabilities โ
๏ฝ Posterior Probability [P(H/X)]
๏ฝ Prior Probability [P(H)]
๏ฝ where X is data tuple and H is some hypothesis.
๏ฝ According to Bayes' Theorem,
๏ฝ P(H/X)= P(X/H)P(H) / P(X)
3. Naรฏve Bayes
๏ฝ It is a classification technique based on Bayesโ Theorem with an
assumption of independence among predictors.
๏ฝ In simple terms, a Naive Bayes classifier assumes that the
presence of a particular feature in a class is unrelated to the
presence of any other feature.
๏ฝ For example, a fruit may be considered to be an apple if it is
red, round, and about 3 inches in diameter. Even if these
features depend on each other or upon the existence of the
other features, all of these properties independently
contribute to the probability that this fruit is an apple and that
is why it is known as โNaiveโ.
๏ฝ Naive Bayes model is easy to build and particularly useful for
very large data sets. Along with simplicity, Naive Bayes is
known to outperform even highly sophisticated classification
methods.
4. ๏ฝ Bayes theorem provides a way of calculating posterior
probability P(c|x) from P(c), P(x) and P(x|c). Look at the
equation below:
Formula
5. Formula
๏ฝ P(c|x) is the posterior probability of class (c, target) given
predictor (x, attributes).
๏ฝ P(c) is the prior probability of class.
๏ฝ P(x|c) is the likelihood which is the probability of predictor
given class.
๏ฝ P(x) is the prior probability of predictor.
6. Dataset
Day Outlook Temperature Humidity Wind Class: Play ball
D1 Sunny Hot High False No
D2 Sunny Hot High True No
D3 Overcast Hot High False Yes
D4 Rain Mild High False Yes
D5 Rain Cool Normal False Yes
D6 Rain Cool Normal True No
D7 Overcast Cool Normal True Yes
D8 Sunny Mild High False No
D9 Sunny Cool Normal False Yes
D10 Rain Mild Normal False Yes
D11 Sunny Mild Normal True Yes
D12 Overcast Mild High True Yes
D13 Overcast Hot Normal False Yes
D14 Rain Mild High True No
7. Problem
The weather data, with counts and probabilities
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 true 3 3
rainy 3 2 cool 3 1
sunny 2/9 3/5 hot 2/9 2/5 high 3/9 4/5 false 6/9 2/5 9/14 5/14
overcast 4/9 0/5 mild 4/9 2/5 normal 6/9 1/5 true 3/9 3/5
rainy 3/9 2/5 cool 3/9 1/5
A new day
outlook temperature humidity windy play
sunny cool high true ?
Outlook Temp Humidity Wind
Overcast Mild Normal True