Difference between revisions of "Confusion Matrix"
Jump to navigation
Jump to search
| Line 1: | Line 1: | ||
Decode the sklearn confusion matrix: | Decode the sklearn confusion matrix: | ||
| − | <syntaxhighlight lang=python> | + | <syntaxhighlight lang=python> |
| + | def deconfuse(tn, fp, fn, tp): | ||
print('Precision:', tp/(tp+fp)) | print('Precision:', tp/(tp+fp)) | ||
print('Recall (TPR):', tp/(tp+fn)) | print('Recall (TPR):', tp/(tp+fn)) | ||
Revision as of 20:52, 13 February 2021
Decode the sklearn confusion matrix:
def deconfuse(tn, fp, fn, tp):
print('Precision:', tp/(tp+fp))
print('Recall (TPR):', tp/(tp+fn))
print('Specificity (TNR):', tn/(tn+fp))
print('Accuracy:', (tp+tn)/(tp+tn+fp+fn))
print('F1-score:', tp/(tp+(fn+fp)/2))