Recall Score

MediumMachine LearningArray

Description

Given equal-length binary arrays yTrue and yPred (1 = positive), return recall = TP / (TP + FN), rounded to 4 decimal places. If there are no actual positives, return 0.

Examples

Input:yTrue = [1,0,1,1], yPred = [1,1,1,0]
Output:0.6667
Explanation:

Of all actual positives, the fraction the model recovered is 0.6667.

Input:yTrue = [1,1,1], yPred = [1,0,1]
Output:0.6667
Explanation:

Of all actual positives, the fraction the model recovered is 0.6667.

Input:yTrue = [0,0], yPred = [1,1]
Output:0
Explanation:

Of all actual positives, the fraction the model recovered is 0.

Constraints

  • 1 ≤ yTrue.length ≤ 10⁴
  • values are 0 or 1

Ready to solve this problem?

Practice solo and sharpen your skills for technical interviews.