InferenceAI

Enter at least two characters to search.

Start free

Binary F1 Score

mediumEvaluation20 min25 XP

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 OUTPUT0.8

Start 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).

Topics

PythonEvaluation