# Worksheet 26: Nearest Neighbors

Your name:

Your student ID number:




1. Your high school friend has just moved to the bay area. Your roommate wants you to set them up on a date. How do you decide if they will be compatible?



2. What would your $1$-nearest-neigbhor prediction be for the point $x_{new}$ be? What would your $2$-nearest-neighbor prediction be?

![](https://tselilschramm.org/introstats/figures/practice-nn.png){width="5cm"}

3. What do you notice about the $k$-nearest neighbor model prediction as $k$ increases?  Do you see a disadvantage to taking $k$ too small?  Do you see a disadvantage to taking $k$ too large?




4. Assume that only one example data point has features $x_i$.  If $k = 1$, what will $\hat y = f(x_i)$ be? 



5. Brainstorm as many advantages and disadvantages as you can for using $k$-nearest neighbors vs. linear regression.



