def compute_distances_two_loops(self, X):
    '\n        Compute the distance between each test point in X and each training point\n        in self.X_train using a nested loop over both the training data and the\n        test data.\n\n        Inputs:\n        - X: A numpy array of shape (num_test, D) containing test data.\n\n        Returns:\n        - dists: A numpy array of shape (num_test, num_train) where dists[i, j]\n          is the Euclidean distance between the ith test point and the jth training\n          point.\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):
        for j in range(num_train):
            dists[(i, j)] = np.sqrt(sum(((X[(i,)] - self.X_train[(j,)]) ** 2)))
            pass
    return dists
Compute the distance between each test point in X and each training point
in self.X_train using a nested loop over both the training data and the
test data.

Inputs:
- X: A numpy array of shape (num_test, D) containing test data.

Returns:
- dists: A numpy array of shape (num_test, num_train) where dists[i, j]
  is the Euclidean distance between the ith test point and the jth training
  point.
def compute_distances_two_loops(self, X):
    '\n        Compute the distance between each test point in X and each training point\n        in self.X_train using a nested loop over both the training data and the\n        test data.\n\n        Inputs:\n        - X: A numpy array of shape (num_test, D) containing test data.\n\n        Returns:\n        - dists: A numpy array of shape (num_test, num_train) where dists[i, j]\n          is the Euclidean distance between the ith test point and the jth training\n          point.\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):
        for j in range(num_train):
            dists[(i, j)] = np.sqrt(sum(((X[(i,)] - self.X_train[(j,)]) ** 2)))
            pass
    return dists