diff --git a/src/experiments/knn/knn.py b/src/experiments/knn/knn.py index c5d4617..d06d20d 100644 --- a/src/experiments/knn/knn.py +++ b/src/experiments/knn/knn.py @@ -6,7 +6,7 @@ import csv from sklearn.preprocessing import MinMaxScaler from enum import Enum import random -from sklearn.metrics import confusion_matrix +from sklearn.metrics import confusion_matrix, accuracy_score, precision_score, recall_score class Tree(Enum): ACCASIA = 0 @@ -102,4 +102,11 @@ for validateId in range(0, tags_len - 1): # Create a heatmap sns.heatmap(confusion_matrix(tag_true, tag_predict), annot=True) plt.title( "Confusion Matrix KNN" ) -plt.show() \ No newline at end of file +plt.show() + +# Score +print("Accuracy score", accuracy_score(tag_true, tag_predict)) +print("Precision score (macro)", precision_score(tag_true, tag_predict, average='macro')) +print("Precision score (micro)", precision_score(tag_true, tag_predict, average='micro')) +print("Recall score (macro)", recall_score(tag_true, tag_predict, average='macro')) +print("Recall score (micro)", recall_score(tag_true, tag_predict, average='micro')) \ No newline at end of file