in Others recategorized by
963 views
0 votes
0 votes

Given the two-dimensional dataset consisting of $5$ data points from two classes (circles and squares) and assume that the Euclidean distance is used to measure the distance between two points. The minimum odd value of $k$ in $k$-nearest neighbor algorithm for which the diamond $(\diamond)$ shaped data point is assigned the label square is $\_\_\_\_\_\_\_$.

in Others recategorized by
by
963 views

1 Answer

0 votes
0 votes

$K=5$

In KNN, we assign the test data point to that class which has the majority representative.

Since, there are $3$ squares and $2$ circles, So, assuming the Euclidean distance or $L_2$-norm distance measure, if we have to assign the test data point i.e. the diamond shaped data point to the square shaped data point, we have to take all the square shaped data points in its neighbor boundary which automatically includes the circle shaped data points.

If we make this setting then we will be having $5$ nearest neighbor data points and so $K=5$ and in this way test data point is assigned the label as sqaure because $\mathbb{P}(\frac{3}{5})>\mathbb{P}(\frac{2}{5})$

Related questions