简体   繁体   English

如何在tensor2tensor中使用F1分数

[英]How to use F1 score in tensor2tensor

I want to add F1 score on my multiclass classification problem. 我想在我的多类分类问题上添加F1分数。 I did not find F1 in the build-in metrics list. 我没有在内置指标列表中找到F1。 Is F1 somewhere in tensor2tensor or I have to overwrite eval_metrics() and use my code or take it from TensorFlow? F1是在tensor2tensor中的某个地方还是我必须覆盖eval_metrics()并使用我的代码或从TensorFlow中获取它?

You have to import it from scikit learn: 你必须从scikit中导入它:

from sklearn.metrics import f1_score

Then you can do 那你可以做

f1 = f1_score(y_test, y_classes)
print(f1)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM