Last active
June 24, 2020 14:15
-
-
Save Mehdi-Amine/794fd5db549acdbbc25d7cec11a4eca2 to your computer and use it in GitHub Desktop.
accuracy of a happy neural network hopefully
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 precision(tp, fp): | |
return tp / (tp + fp) | |
print(f"Precision: {precision(tp, fp)}") | |
def recall(tp, fn): | |
return tp / (tp + fn) | |
print(f"Recall: {recall(tp, fn)}") | |
def accuracy(tp, fp, tn, fn): | |
return (tp + tn) / (tp + fp + tn + fn) | |
print(f"Accuracy: {accuracy(tp, fp, tn, fn)}") | |
''' | |
Out: | |
Precision: 0.9876712328767123 | |
Recall: 0.9677852348993289 | |
Accuracy: 0.9816666666666667 | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment