【问题标题】:How to get tf.estimator.predict() accuracy?如何获得 tf.estimator.predict() 准确性?
【发布时间】:2020-02-06 02:44:42
【问题描述】:

我知道tf.estimator.evaluate() 返回包含由eval_metrics 定义的字段的字典。因此,我们可以通过设置相应的字段让evaluate()返回模型精度,使用result["accuracy"]得到精度。

但是,tf.estimator.predict() 返回一个生成器,我怎样才能以类似的方式获得预测精度?如果我不能,有没有其他方法可以使用tf.estimator 获得预测准确性?

我确实想使用tf.estimator,因为它与代码的其他部分一致。

提前致谢!

【问题讨论】:

  • 您可以遍历预测生成器并将输出与您的参考标签进行比较。准确度是正确预测的数量除以预测的总数。

标签: python tensorflow machine-learning tensorflow-estimator


【解决方案1】:

这样的东西可能会对您有所帮助:tf.nn.softmax_cross_entropy_with_logits(logits=output, labels=y)

来源:https://datascience.stackexchange.com/questions/28968/get-the-probabilities-of-tensorflow

【讨论】:

  • 对您的答案进行简单的解释会很棒!
猜你喜欢
  • 1970-01-01
  • 2017-06-25
  • 2014-08-25
  • 2019-01-01
  • 2021-10-18
  • 2018-12-05
  • 2020-07-08
  • 2020-06-01
  • 2019-09-20
相关资源
最近更新 更多