Loading...
Compute precision, recall, and F1 score for binary classification.
Given lists of true and predicted labels:
Precision=TP+FPTP Recall=TP+FNTP F1=2⋅Precision+RecallPrecision⋅Recall
Return a tuple (precision, recall, f1), each rounded to 4 decimal places. If a denominator is 0, return 0.0 for that metric.
y_true = [1, 0, 1, 1, 0, 1] y_pred = [1, 0, 0, 1, 1, 1]
(0.75, 0.75, 0.75)
y_true and y_pred: TP=3, FP=1, FN=1