PythiloLesson 3 of 12 · progress kept in this browser

Precision, Recall & F1

Count true positives before dividing. A zero denominator returns zero; accuracy alone hides an imbalanced classifier.

tp, fp, fn = 2, 1, 3
print(tp / (tp+fp))
print(tp / (tp+fn))
Your task

prf(actual, predicted) returns (precision, recall, F1) for binary 0/1 labels. For each undefined ratio return 0.0.