Binary F1 Score
Given TP, FP and FN, return F1 rounded to six decimals. Return 0 when undefined.
Examples
EXAMPLE WALKTHROUGHbalanced
A guided view of the published example, not a trace of your code.
INPUT
[8,2,2]TASKf1_score()
EXPECTED OUTPUT
0.8Start with the input values shown in this example.
Example 1 of 2
Input: tp = 8, fp = 2, fn = 2
Output: 0.8
Explanation: balanced
Input: tp = 0, fp = 0, fn = 0
Output: 0
Explanation: undefined
Hint 1
F1 can be written as 2TP / (2TP + FP + FN).