gpt4 book ai didi

tensorflow - 了解 estimator.evaluate 和输出比较

转载 作者:行者123 更新时间:2023-12-02 06:50:18 25 4
gpt4 key购买 nike

感谢您对 tensorflow 社区的帮助!

我有一个关于理解和可视化估算器评估函数输出的问题。

我有一个 DNNClassifier,并使用 10 个预测输出范围的数据对其进行了训练。

训练和运行后

accuracy = classifier.evaluate(input_fn = test_input_fn)['accuracy']

我的准确率为 33.8%。谁知道那有多好。 (可能不好)

如何查看每个比较的输出?

在运行 test_data 时,我想看看估计值是多少,实际值是多少。基本上是并排的 y 和 y'。

类似于:[0 0 0 0 0 0 0 0 1] 与 [0 0 0 0 0 0 0 0 1 0] 'false'

而不是仅仅看到聚合的整体准确度。

谢谢!

最佳答案

因此,如果有人阅读了上面的问题,并理解了我试图做的事情(查看预测的输出),我有一个解决方案。

解决方案是使用 .predict() 方法。

一个很好的例子在这里: https://www.tensorflow.org/get_started/estimator#classify_new_samples

我的代码最终看起来像:

predict_input_fn = tf.estimator.inputs.numpy_input_fn(
x = {"x": np.array(predict_set.data)},
num_epochs = 1,
shuffle = False)

predictions = list(classifier.predict(input_fn=predict_input_fn))

print("\n Predictions:")
print(len(predictions))

for p in predictions:
print(int(p['classes'][0]))

它在一列中输出预测,我可以将其复制/粘贴到一些电子表格程序中以检查我的数据。

关于tensorflow - 了解 estimator.evaluate 和输出比较,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46720165/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com