# Nearest neighbor methods

Given a training set $\{(x_1, y_1), \dots, (x_n, y_n)\}$, consider the following: $$\hat{Y}(x_i) = \frac{1}{k} \sum_{x_i \in N_{k}(x)} y_i$$

Suppose $k=3$. Is this formula saying that we pick the $3$ closest neighbors of $x$ and average over their responses? So if $x_i = x_1$ then we would choose the closest $3$ values to $x_1$ (say $x_2,x_3,x_4$) and compute the following: $$\hat{Y}(x_1) = \frac{y_2+y_3+y_4}{3}$$

Is the idea to see whether $\hat{Y}(x_1)$ agrees with $y_1$? If not, are different classification rules needed?

• We won't be able to answer your question if you don't tell us what $N_k(x)$ is. – Stephan Kolassa Jun 13 '13 at 9:18