diff options
Diffstat (limited to 'evaluation/f1.py')
| -rw-r--r-- | evaluation/f1.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/evaluation/f1.py b/evaluation/f1.py new file mode 100644 index 0000000..94a8568 --- /dev/null +++ b/evaluation/f1.py @@ -0,0 +1,12 @@ +from sklearn.metrics import f1_score, precision_score, recall_score + + +def evaluate(y_true: list, y_pred: list) -> float: + """ + F1评估方法 + :param y_true: 真实标签 + :param y_pred: 检测标签 + :return: f1、recall、precision + """ + f1 = f1_score(y_true, y_pred) + return f1
\ No newline at end of file |
