k-nearest neighbours predicts a new point's label by looking at the k closest training points and taking the most common label among them. The data is illustrative.
For each row of new_points, find the 3 nearest rows of train (straight-line distance) and predict the label most common among their labels. Store the predictions as an array.
Expected answer
Store your answer in result.
Hints, the later steps and the answer come with Pro.
import numpy as np train = np.array([[1.0, 1.0], [1.5, 2.0], [2.0, 1.0], [6.0, 6.0], [7.0, 5.5], [6.5, 7.0], [4.0, 4.5]]) labels = np.array([0, 0, 0, 1, 1, 1, 1]) new_points = np.array([[1.2, 1.4], [6.2, 6.1], [3.5, 3.5], [4.5, 5.0]]) result = ...