【发布时间】:2017-12-10 21:17:25
【问题描述】:
我正在查看 this tutorial 使用 Tensorflow 创建卷积神经网络。
在神经网络构建和训练后,在教程中,它是这样测试的:
eval_results = mnist_classifier.evaluate(
x=eval_data, y=eval_labels, metrics=metrics)
print(eval_results)
但是,我没有测试集的标签,所以我想只使用训练示例来运行它,如下所示:
eval_results = mnist_classifier.evaluate(x=test_data, metrics=metrics)
但是,如果我这样做,我会收到此警告,然后执行停止:
WARNING:tensorflow:From ../src/script.py:169: calling BaseEstimator.evaluate (from tensorflow.contrib.learn.python.learn.estimators.estimator) with x is deprecated and will be removed after 2016-12-01.
Instructions for updating:
Estimator is decoupled from Scikit Learn interface by moving into
separate class SKCompat. Arguments x, y and batch_size are only
available in the SKCompat class, Estimator will only accept input_fn.
Example conversion:
est = Estimator(...) -> est = SKCompat(Estimator(...))
Traceback (most recent call last):
File "../src/script.py", line 172, in <module>
main()
File "../src/script.py", line 169, in main
eval_results = mnist_classifier.evaluate(x=test_data, metrics=metrics)
File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 289, in new_func
return func(*args, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 530, in evaluate
102.5s
7
return SKCompat(self).score(x, y, batch_size, steps, metrics)
File "/opt/conda/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 1365, in score
name='score')
File "/opt/conda/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 816, in _evaluate_model
% self._model_dir)
tensorflow.contrib.learn.python.learn.estimators._sklearn.NotFittedError: Couldn't find trained model at /tmp/mnist_convnet_model.
【问题讨论】:
标签: python tensorflow