Database Reference
In-Depth Information
The next step is to compute conditional probabilities , where
and . Count the number
of “No” and “Yes” entries for each Age group, and normalize by the total number
of “No” and “Yes” entries to get the conditional probabilities.
ageCounts <- table(traindata[,c("Enrolls", "Age")])
ageCounts
Age
Enrolls <=30 >40 31 to 40
0 0 0
No 3 2 0
Yes 2 3 4
ageCounts <- ageCounts/rowSums(ageCounts)
ageCounts
Age
Enrolls <=30 >40 31 to 40
No 0.6000000 0.4000000 0.0000000
Yes 0.2222222 0.3333333 0.4444444
Do the same for the other attributes including Income , JobSatisfaction , and
Desire .
incomeCounts <- table(traindata[,c("Enrolls", "Income")])
incomeCounts <- incomeCounts/rowSums(incomeCounts)
incomeCounts
Income
Enrolls High Low Medium
No 0.4000000 0.2000000 0.4000000
Yes 0.2222222 0.3333333 0.4444444
jsCounts <- table(traindata[,c("Enrolls",
"JobSatisfaction")])
jsCounts <- jsCounts/rowSums(jsCounts)
jsCounts
Jobsatisfaction
Enrolls No Yes
No 0.8000000 0.2000000
Yes 0.3333333 0.6666667
desireCounts <- table(traindata[,c("Enrolls", "Desire")])
desireCounts <- desireCounts/rowSums(desireCounts)
Search WWH ::




Custom Search