Difficulty: Easy Tags: Metrics & Evaluation, Classification
Spotify's skip-predictor flags tracks a listener is likely to abandon within 5 seconds. Before the model is allowed near production traffic, it has to clear a basic precision/recall sanity check on a held-out batch.
Precision = TP / (TP + FP)
Recall = TP / (TP + FN)
F1 = 2 * Precision * Recall / (Precision + Recall)
n
p_1 y_1
p_2 y_2
...
p_n y_n
p_i is the predicted binary label, y_i the true label, both 0 or 1.
precision recall f1, space-separated, to 6 decimals.
1 <= n <= 10^6Input
8
1 1
1 0
0 0
1 1
0 0
0 1
1 1
0 0
Output
0.750000 0.750000 0.750000
Explanation: TP = 3 (rows 1, 4, 7), FP = 1 (row 2), FN = 1 (row 6).
P = 3/4 = 0.75, R = 3/4 = 0.75, F1 = 0.75.
No results yet
Run your code to check it against the examples, or submit to run every test.