assignment1_colab/assignment1/cs231n/classifiers/k_nearest_neighbor.py
def compute_distances_one_loop(self, X):
        """
        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
        """
        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):
            #######################################################################
            # TODO:                                                               #
            # Compute the l2 distance between the ith test point and all training #
            # points, and store the result in dists[i, :].                        #
            # Do not use np.linalg.norm().                                        #
            #######################################################################
            # *****START OF YOUR CODE (DO NOT DELETE/MODIFY THIS LINE)*****

            pass

            # *****END OF YOUR CODE (DO NOT DELETE/MODIFY THIS LINE)*****
        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
        
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
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):
        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):
            pass
        return dists
def compute_distances_one_loop ( self , X ) : 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 ) : 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.
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 .
"""
        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
        """ ####################################################################### # TODO:                                                               # # Compute the l2 distance between the ith test point and all training # # points, and store the result in dists[i, :].                        # # Do not use np.linalg.norm().                                        # ####################################################################### # *****START OF YOUR CODE (DO NOT DELETE/MODIFY THIS LINE)***** # *****END OF YOUR CODE (DO NOT DELETE/MODIFY THIS LINE)*****
self
X