Letβs say we have a sample set and is the sample while .
We want to measure the distance (letβs say, using Euclidean distance):
And so, the nearest neighbor decision is
Note here that is the ground truth class of , while is the predicted class of .
Nearest-Neighbor
We find the nearest value () to our target value . Then, we copy whatever is the label of to .
Some questions that you may have:
- What distance to use?
- How many samples should we base it on, data could be too noisy.