Exact Procedure for KNN classification

68 Views Asked by At

I want to know the exact procedure involved in KNN classification. I understand the bigger picture but I miss the details to implement.

I have 3 pieces of data: Train, Validate and Test.

1) Suppose we have training points $x_1, x_2,\dots,x_N$ each in $\Bbb R^D$ where $D$ is number of features and the labels are $y_1,\dots,y_N$ each in $\Bbb R$ where $N$ is number of training points.

What does training involve? Do I need to pick nearest neighbors for each point $j\in\{1,\dots,N\}$ and relabel the points based on majority vote?

2) What does validation involve?

Given a validation point $x\in\Bbb R^D$ with label $y$ what should I do?

3) Is testing same as validation?

1

There are 1 best solutions below

0
On

I think the points from $R^D$ that are not $x_1, x_2,\dots,x_N$ should be classified, you should not relabel $x_1, x_2,\dots,x_N$ .
For validation you need points from $R^D$ with valid labels ( the same $x_1, x_2,\dots,x_N$ have).