Skip to content
Snippets Groups Projects
Commit 08be5a9b authored by Saidi Aya's avatar Saidi Aya
Browse files

Update knn.py

parent 14e42b7b
Branches
No related tags found
No related merge requests found
def distance_matrix(Y , X):
#This function takes as parameters two matrices X and Y
dists = np.sqrt(np.sum(-2 * np.multiply(X, Y)+ np.multiply(Y, Y) + np.multiply(X, X)))
#dists is the euclidian distance between two matrices
return dists
def knn_predict(dists, labels_train,k):
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment