Created
October 15, 2018 09:16
-
-
Save omarsar/090197c2be8799226cd42229e3ffcba1 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
def numeric_score(prediction, groundtruth): | |
FP = np.float(np.sum((prediction == 1) & (groundtruth == 0))) | |
FN = np.float(np.sum((prediction == 0) & (groundtruth == 1))) | |
TP = np.float(np.sum((prediction == 1) & (groundtruth == 1))) | |
TN = np.float(np.sum((prediction == 0) & (groundtruth == 0))) | |
return FP, FN, TP, TN | |
def accuracy(prediction, groundtruth): | |
FP, FN, TP, TN = numeric_score(prediction, groundtruth) | |
N = FP + FN + TP + TN | |
accuracy = np.divide(TP + TN, N) | |
return accuracy * 100.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment