def predict_labels(self, dists, k=1):
    '\n        Given a matrix of distances between test points and training points,\n        predict a label for each test point.\n\n        Inputs:\n        - dists: A numpy array of shape (num_test, num_train) where dists[i, j]\n          gives the distance betwen the ith test point and the jth training point.\n\n        Returns:\n        - y: A numpy array of shape (num_test,) containing predicted labels for the\n          test data, where y[i] is the predicted label for the test point X[i].\n        '
    num_test = dists.shape[0]
    y_pred = np.zeros(num_test)
    for i in range(num_test):
        closest_y = []
        closest_y = self.y_train[dists[(i,)].argsort()[:k]]
        pass
        (unique, counts) = np.unique(closest_y, return_counts=True)
        y_pred[i] = unique[np.argmax(counts)]
        pass
    return y_pred
Given a matrix of distances between test points and training points,
predict a label for each test point.

Inputs:
- dists: A numpy array of shape (num_test, num_train) where dists[i, j]
  gives the distance betwen the ith test point and the jth training point.

Returns:
- y: A numpy array of shape (num_test,) containing predicted labels for the
  test data, where y[i] is the predicted label for the test point X[i].
def predict_labels(self, dists, k=1):
    '\n        Given a matrix of distances between test points and training points,\n        predict a label for each test point.\n\n        Inputs:\n        - dists: A numpy array of shape (num_test, num_train) where dists[i, j]\n          gives the distance betwen the ith test point and the jth training point.\n\n        Returns:\n        - y: A numpy array of shape (num_test,) containing predicted labels for the\n          test data, where y[i] is the predicted label for the test point X[i].\n        '
    num_test = dists.shape[0]
    y_pred = np.zeros(num_test)
    for i in range(num_test):
        closest_y = []
        closest_y = self.y_train[dists[(i,)].argsort()[:k]]
        pass
        (unique, counts) = np.unique(closest_y, return_counts=True)
        y_pred[i] = unique[np.argmax(counts)]
        pass
    return y_pred