Skip to content
Snippets Groups Projects
Commit 0aa2a93f authored by Dubray Chloe's avatar Dubray Chloe
Browse files

Delete knn.py

parent 7460daf4
No related branches found
No related tags found
No related merge requests found
import numpy as np
import pickle
import os
def distance_matrix (M1, M2) :
sum_squares_1 = np.sum(M1**2, axis = 1, keepdims = True)
sum_squares_2 = np.sum(M2**2, axis = 1, keepdims = True)
dot_product = np.dot(M1, M2.T)
dists = np.sqrt(sum_squares_1 - 2*dot_product + sum_squares_2.T)
return dists
split_dataset (data, labels, split)
def knn_predict (dists, labels_train, k) :
train_set
test_set
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment