Created
November 26, 2017 12:41
-
-
Save joao-timescale/57f3f63be05f8db279059e505cf4d898 to your computer and use it in GitHub Desktop.
k-NN metrics
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
hits = np.asarray([cnf_matrix[i][i] for i in range(cnf_matrix.shape[0])]) | |
expected = np.sum(cnf_matrix, axis=0) | |
num_hits = np.sum(hits) | |
total = test_data.shape[0] | |
precision = 100 * (num_hits / total) | |
recall_per_class = hits / expected | |
recall = 100 * (np.sum(recall_per_class) / recall_per_class.shape[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment