Premium problem22. Precision and Recall

Medium Locked

Precision and recall are the same overlap read with different denominators, which is exactly why P(A∣B)≠P(B∣A)P(A \mid B) \neq P(B \mid A):

Precision=TPTP+FPRecall=TPTP+FN\text{Precision} = \frac{TP}{TP + FP} \qquad \text{Recall} = \frac{TP}{TP + FN}

Return a dict with keys "precision" and "recall". If a denominator is zero, use 0.0 for that metric.

Input

tp = 10
fp = 10
fn = 30

Output

{'precision': 0.5, 'recall': 0.25}

Premium problem

This one's part of Premium. Unlock the full Probability track plus every other premium problem on the site.

Implement solve(...)