def compute_distances_one_loop(self, X):
    '\n        Compute the distance between each test point in X and each training point\n        in self.X_train using a single loop over the test data.\n\n        Input / Output: Same as compute_distances_two_loops\n        '
    num_test = X.shape[0]
    num_train = self.X_train.shape[0]
    dists = np.zeros((num_test, num_train))
    for i in range(num_test):
        dists[i, :] = np.sqrt(np.sum(((self.X_train - X[i, :]) ** 2), 1))
        pass
    return dists
Compute the distance between each test point in X and each training point
in self.X_train using a single loop over the test data.

Input / Output: Same as compute_distances_two_loops
def compute_distances_one_loop(self, X):
    '\n        Compute the distance between each test point in X and each training point\n        in self.X_train using a single loop over the test data.\n\n        Input / Output: Same as compute_distances_two_loops\n        '
    num_test = X.shape[0]
    num_train = self.X_train.shape[0]
    dists = np.zeros((num_test, num_train))
    for i in range(num_test):
        dists[i, :] = np.sqrt(np.sum(((self.X_train - X[i, :]) ** 2), 1))
        pass
    return dists