From bfd24fdb64fb95cc60c96c8b73608c8a891d9c0c Mon Sep 17 00:00:00 2001 From: oscarchaufour <101994223+oscarchaufour@users.noreply.github.com> Date: Wed, 8 Nov 2023 20:33:19 +0100 Subject: [PATCH] Update knn.py --- knn.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/knn.py b/knn.py index f3006bd..511353b 100644 --- a/knn.py +++ b/knn.py @@ -15,12 +15,9 @@ from tqdm import tqdm def distance_matrix(A,B) : sum_of_squaresA= np.sum(A**2, axis = 1, keepdims = True) sum_of_squaresB = np.sum(B**2, axis = 1) - # sum_of_squaresA = np.tile(sum_of_squaresAVect, (np.shape(B)[0], 1)) - # sum_of_squaresB = np.tile(sum_of_squaresBVect, (np.shape(A)[0], 1)) # Calculate the dot product between the two matrices dot_product = np.dot(A, B.T) - # dot_product = np.einsum('ij,jk', A, B.T) # Calculate the Euclidean distance matrix using the hint provided dists = np.sqrt(sum_of_squaresA + sum_of_squaresB - 2 * dot_product) return dists -- GitLab