Uploaded by المدمر 4

Naive Bayes Algorithm

advertisement
Age
Income
Student
Credit Rating
Buys Computer
youth
high
no
fair
no
youth
high
no
excellent
no
P(No)
youth
medium
no
fair
no
senior
low
yes
excellent
no
senior
medium
no
excellent
no
P(Youth)
P(Medium)
P(Yes)
P(Fair)
Product
P(X | C1 = 'No')
3 / 5 = 0.6
2 / 6 = 0.3
1 / 7 = 0.1
2 / 8 = 0.2
0.6 * 0.3 * 0.1 * 0.2 = 0.003
0.35 * 0.003 = 0.001
youth
low
yes
fair
yes
P(Yes)
youth
medium
yes
excellent
yes
senior
medium
no
fair
yes
senior
low
yes
fair
yes
senior
medium
yes
fair
yes
middle
high
no
fair
yes
middle
low
yes
excellent
yes
middle
medium
no
excellent
yes
middle
high
yes
fair
yes
P(Youth)
P(Medium)
P(Yes)
P(Fair)
Product
P(X | C1 = 'Yes')
2 / 5 = 0.4
4 / 6 = 0.6
6 / 7 = 0.8
6 / 8 = 0.7
0.4 * 0.6 * 0.8 * 0.7 = 0.13
0.64 * 0.13 = 0.08
So, X belongs to class "Buys Computer = Yes" because 0.08 > 0.001
5 / 14 = 0.35
Homework 1
9 / 14 = 0.64
‫ﺛﺎﻣر ﺣﺳﯾن ﻋﻠﻲ‬
Download