Loading...

Precision and Recall

A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.

Domain
Python
Difficulty
medium
Seniority
senior

Problem

Our ML model evaluation pipeline needs precision and recall metrics computed inline. Given equal-length lists of actual and predicted binary labels, return a dict with 'precision' and 'recall' values. Handle zero-denominator cases by returning 0.0.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.