Interview Query

Precision and Recall

Start Timer

0:00:00

Upvote
4
Downvote
Save question
Mark as completed
View comments (10)
Next question

Given a 2-D matrix P of predicted values and actual values, write a function precision_recall to calculate precision and recall metrics.

Return the ordered pair (precision, recall).

Example:

Input:


P = [[121, 9],
    [17, 144]]

where P represents the following table

Predicted =TRUE Predicted =FALSE
Actual =TRUE 121 9
Actual =FALSE 17 144

Output:

def precision_recall(P) -> (0.931, 0.877,)
.
.
.
.
.


Comments

Loading comments