Precision, Recall, F1 from Counts

Xem dạng PDF

Gửi bài giải

Điểm: 100,00
Giới hạn thời gian: 2.0s
Giới hạn bộ nhớ: 256M

Tác giả:
Dạng bài
Ngôn ngữ cho phép
Python

Task

Given TP, FP, FN, TN as integers, compute precision, recall, and F1.

  • If TP + FP = 0, precision = 0.
  • If TP + FN = 0, recall = 0.
  • If precision + recall = 0, F1 = 0.

Input

One line: four non-negative integers TP FP FN TN

Output

Three space-separated floats: precision recall f1

Example

Input:

3 1 1 5

Output:

0.75 0.75 0.75

Scaffolding

def precision_recall_f1(tp: int, fp: int, fn: int, tn: int) -> tuple: ...

Notes

Track A: no NumPy needed — plain arithmetic. This is the atom of anomaly detector evaluation: every alert is TP, FP, or FN.


Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.