From a3d152ababbb6c40d8a481ed1e39b518401cc030 Mon Sep 17 00:00:00 2001 From: corentin <corentin.massala@gmail.com> Date: Thu, 9 Nov 2023 11:16:31 +0100 Subject: [PATCH] update the graph --- knn.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/knn.py b/knn.py index fece0ca..843efe2 100644 --- a/knn.py +++ b/knn.py @@ -55,12 +55,15 @@ def bench_knn(): accuracies.append(accuracy) # Save and show the graph of accuracies - fig = plt.figure() + plt.figure(figsize=(8, 6)) + plt.xlabel('K') + plt.ylabel('Accuracy') plt.plot(k_indices, accuracies) plt.title("Accuracy as function of k") + plt.legend() + plt.grid(True) plt.show() plt.savefig('image-classification/results/knn_batch_1.png') - plt.close(fig) if __name__ == "__main__": @@ -75,9 +78,4 @@ if __name__ == "__main__": # x_test = np.array([[1,2],[4,6]]) # x_train = np.array([[2,4],[7,2],[4,6]]) # y_train = [1,2,1] - # dist = distance_matrix(x_test,x_train) - - - - - \ No newline at end of file + # dist = distance_matrix(x_test,x_train) \ No newline at end of file -- GitLab