Question: Question 3 [ 30 marks] The basic k-nearest neighbor algorithm is given below. Algorithm Basic k-NN classification algorithm. 1. Let k be the number of
Question 3 [ 30 marks] The basic k-nearest neighbor algorithm is given below. Algorithm Basic k-NN classification algorithm. 1. Let k be the number of nearest neighbors and D be the set of training examples. 2. for each test example z=(x,y) do 3. Compute d(x,x), the distance between z and every example, (x,y)D. 4. Select DzD, the set of k closest training examples to z. 5. y=argmax(x1,yj)DtI(v=yi), where I(a=b)=1 if a=b and 0 otherwise. 6. end for You are given the one-dimensional data set D shown in the table below. The data set D has ten data points. The one-dimensional data set D a. [10 marks] Use the majority voting technique to classify the test example z=5.0 using 9-NN (i.e., k=9 ). b. [20 marks] Use the distance-weighted voting technique to classify the test example z=5.0 using 9- NN (i.e., k=9 )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
