Report more than accuracy: compute precision, recall, F1, and confusion counts for a binary classifier.
Required APIdef classification_report(y_true, y_pred, positive=1):
return {'accuracy': ..., 'precision': ..., 'recall': ..., 'f1': ..., 'confusion': ...}BehaviorThink through the mechanism first if you want the extra reasoning step. It never blocks the editor.
classification_report([1, 1, 0, 0], [1, 0, 1, 0])the headline score agrees with its underlying counts
classification_report([1, 0], [1, 0])a perfect classifier is explicit rather than implied
2 hidden edge tests run after the visible contract passes.
Run Tests to see the contract verdicts here.