Skip to content
Snippets Groups Projects
Commit 06fb753f authored by MSI\alber's avatar MSI\alber
Browse files

First commit

parent 1057ffde
No related branches found
No related tags found
No related merge requests found
import numpy as np
def distance_matrix(m1, m2):
if m1.shape != m2.shape:
raise ValueError("Dimensions must be identical")
x = (m1 - m2) ** 2
y = np.sum(x)
dist = np.sqrt(y)
return dist
def knn_predict(dist, labels_train, k, ):
return
def evaluate_knn(data_train , labels_train,data_test ,labels_test, k):
return
\ No newline at end of file
import pickle
import numpy as np
def read_cifar_batch(batch):
with open(batch, 'rb') as fo:
dict = pickle.load(fo, encoding='bytes')
data = dict[b'data']
labels = dict[b'labels']
return data.astype(np.float32), np.array(labels, dtype=np.int64)
batch='data/cifar-10-batches-py/data_batch_1'
data, labels = read_cifar_batch(batch)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment