如何查找已接受过培训的学员的f1成绩&;用python保存模型

如何查找已接受过培训的学员的f1成绩&;用python保存模型,python,keras,model,Python,Keras,Model,假设我有一个已经训练并保存的模型(使用python)。现在,如果我想获得该模型的f1分数,那么如何使用python实现呢?任何人都知道这一点,请帮助。y\u true是您已经拥有并测试模型的结果列表 y_pred是模型预测的列表 from sklearn.metrics import f1_score y_true = [0, 1, 2, 0, 1, 2] y_pred = [0, 2, 1, 0, 0, 1] f1_score(y_true, y_pred, average='macro')

假设我有一个已经训练并保存的模型(使用python)。现在,如果我想获得该模型的f1分数,那么如何使用python实现呢?任何人都知道这一点,请帮助。

y\u true是您已经拥有并测试模型的结果列表

y_pred是模型预测的列表

from sklearn.metrics import f1_score
y_true = [0, 1, 2, 0, 1, 2]
y_pred = [0, 2, 1, 0, 0, 1]

f1_score(y_true, y_pred, average='macro')
0.26
f1_score(y_true, y_pred, average='micro')
0.33
f1_score(y_true, y_pred, average='weighted')
0.26
f1_score(y_true, y_pred, average=None)
array([0.8, 0. , 0. ])
如果有效,您可以将其标记为已解决。

请参阅此。对于keras,请检查此项