Change parameters and inspect the actual computation behind k-nearest neighbors.
2Predicted class
2Votes for class 0
3Votes for class 2
Euclidean distance and majority voting; the query y is fixed at 0.7. Feature scales affect distances, so fit scaling on training data in practical applications.
Use this experiment to test your understanding
Predict the effect of changing a parameter before inspecting the output. Identify the responsible term in the formula and explain how the teaching model differs from a real application.