The team needs a reliable implementation for fraud alert evaluation in a production-oriented ML workflow. A small implementation error can change the model input or metric enough to make a downstream result misleading.
Given binary predictions and labels, compute precision and recall without using a metrics library.
Count true positives, false positives and false negatives (label 1 is positive) and return precision and recall. A ratio whose denominator is zero is reported as 0.0.
Implement solve(y_true,y_pred).
Returns. Return a tuple (precision, recall) of Python floats.
Example 1
Input:
solve([1, 1, 0, 0], [1, 0, 1, 0])
Output:
(0.5, 0.5)
Example 2
Input:
solve([1, 1, 0], [0, 0, 0])
Output:
(0.0, 0.0)
No results yet
Run your code to check it against the examples, or submit to run every test.