From 2236622f33f307bc55e789777e0eead64373f27e Mon Sep 17 00:00:00 2001 From: zyq Date: Thu, 25 May 2023 15:30:02 +0800 Subject: 首次提交本地代码 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- evaluation/f1.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 evaluation/f1.py (limited to 'evaluation/f1.py') 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 -- cgit v1.2.3