-
-
Save jurand71/46c1a5bb8d8d57e58cb327ce1130f669 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("Dokładność modelu dla k=1") | |
classifier = KNearestNeighbor() | |
classifier.train(X_train, y_train) | |
dists = classifier.compute_distances_no_loops(X_test) | |
y_pred = classifier.predict_labels(dists, k=1) | |
num_correct = np.sum(y_pred == y_test) | |
num_test = X_test.shape[0] | |
accuracy = float(num_correct) / num_test | |
print('Poprawnie zidentyfikowano %d na %d obrazów testowych => dokładność: %f' % (num_correct, num_test, accuracy)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment