Manual calculations of KNN and Bayesian Classifications

Task 1
Some simplification is used here: 0=no, 1=yes, 0.5=sometimes. Use kNN to predict the
class of the new tuple < B=0,E=1,F=0,W=0.5,L=1,C=?>. You assume k=3. The
distance function between tuples is assumed to be Euclidean distance. That is, the
distance between two tuples t1, and t2 are calculated by
d12=sqrt[(B1-B2)2+(E1-E2)2+(F1-F2)2+(W1-W2)2+(L1-L2)2]
where B1 and B2 are respective B values for t1 and t2 (others are the same).
Task 2
Given the above table,
a) As we are going to classify < B=0,E=1,F=0,W=0.5,L=1,C=?>, we need to
calculate conditional probabilities for P(B=0|C=m), P(E=1|C=m), P(F=0|C=m),
P(W=0.5|C=m), P(L=1|C=m). The same calculation needs to be done for C=b, C=a,
C=r, and C=f.
If you cannot remember the formula for conditional probabilities, the following will help:
Let N(B=0, C=m) be the number of tuples having B=0 and C=m.
P(B=0|C=m) is N(B=0, C=m) / N(C=m)
P(B=0,E=1|C=m)= N(B=0, E=1, C=m) / N(C=m)
P(B=0|C=m,E=1)= N(B=0, E=1, C=m) / N(C=m,E=1)
b) Use the naive Bayes approach and the conditional probabilities calculated in (a) to
predict the class label for the test tuple < B=0,E=1,F0,W=0.5,L=1,C=?>. Note that
naïve Bayesian assumes the independence among the input variables B,E,F,W, and L,
thus
P(B=0,E=1,F=0,W=0.5,L=1|C=m)
= P(B=0|C=m)*P(E=1|C=m)*P(F=0|C=m)*P(W=0.5|C=m)*P(L=1|C=m)
The probability of the tuple having class m is
P(C=m | B=0,E=1,F=0,W=0.5,L=1)
= P(B=0,E=1,F=0,W=0.5,L=1|C=m)* P(C=m) / P(B=0,E=1,F=0,W=0.5,L=1)
c) Remove the correlated column E and use the naïve Bayesian to do the classification
again for the test tuple < B=0,E=1,F0,W=0.5,L=1,C=?>.
d) Compare b) and c) and explain whether the removal of E helps make the
classification better or worse.

What Students Are Saying About Us

.......... Customer ID: 12*** | Rating: ⭐⭐⭐⭐⭐
"Honestly, I was afraid to send my paper to you, but splendidwritings.com proved they are a trustworthy service. My essay was done in less than a day, and I received a brilliant piece. I didn’t even believe it was my essay at first 🙂 Great job, thank you!"

.......... Customer ID: 14***| Rating: ⭐⭐⭐⭐⭐
"The company has some nice prices and good content. I ordered a term paper here and got a very good one. I'll keep ordering from this website."

"Order a Custom Paper on Similar Assignment! No Plagiarism! Enjoy 20% Discount"