Database Reference
In-Depth Information
traindata
Age Income JobSatisfaction Desire Enrolls
1 <=30 High No Fair No
2 <=30 High No Excellent No
3 31 to 40 High No Fair Yes
4 >40 Medium No Fair Yes
5 >40 Low Yes Fair Yes
6 >40 Low Yes Excellent No
7 31 to 40 Low Yes Excellent Yes
8 <=30 Medium No Fair No
9 <=30 Low Yes Fair Yes
10 >40 Medium Yes Fair Yes
11 <=30 Medium Yes Excellent Yes
12 31 to 40 Medium No Excellent Yes
13 31 to 40 High Yes Fair Yes
14 >40 Medium No Excellent No
testdata
Age Income JobSatisfaction Desire Enrolls
15 <=30 Medium Yes Fair
The first method shown here is to build a naïve Bayes classifier from scratch by
manually computing the probability scores. The first step in building a classifier
is to compute the prior probabilities of the attributes, including Age , Income ,
JobSatisfaction , and Desire . According to the naïve Bayes classifier, these
attributes are conditionally independent. The dependent variable (output variable)
is Enrolls .
Compute the prior probabilities
for Enrolls , where
and
.
tprior <- table(traindata$Enrolls)
tprior
No Yes
0 5 9
tprior <- tprior/sum(tprior)
tprior
No Yes
0.0000000 0.3571429 0.6428571
Search WWH ::




Custom Search