WRITE · TRACE · UNDERSTAND

Precision, Recall & F1

Count true positives before dividing.

Your experiment

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

Python runs in your browser. Your draft stays on this device.

What to look for

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

Watch your code work

Ready to experiment

Write a solution or load the worked answer, then choose Trace & check.

Step through arrays, variables and training curves produced by your own Python.