Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何输出每一类的precision,recall和f1呢? #67

Closed
LuoXingyiAFF opened this issue Jan 25, 2021 · 1 comment
Closed

如何输出每一类的precision,recall和f1呢? #67

LuoXingyiAFF opened this issue Jan 25, 2021 · 1 comment

Comments

@LuoXingyiAFF
Copy link

do_eval 下计算的是平均的p,r和f1
对于数据非常不平衡的多分类NER,好像只看平均值参考意义不大
我如何得到每一类标签的p,r和f1呢?
代码里用estimator来进行封装,我很难将过程中的一些值输出,还请不吝赐教:)

@XueruWang
Copy link

可以通过自定义hook的方式打印:
output_spec = tf.contrib.tpu.TPUEstimatorSpec(
mode=mode,
loss=total_loss,
eval_metrics=eval_metrics,
evaluation_hooks = eval_hooks,
scaffold_fn=scaffold_fn)
在hook里可以直接打印tensor的值,计算详细指标也方便些,具体的实现可以在网上搜一下

@ProHiryu ProHiryu closed this as completed Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants