【发布时间】:2017-05-08 20:09:54
【问题描述】:
我有一个运行良好的深度神经网络。但是,添加以下代码来实现提前停止会导致错误:
validation_metrics = {
"accuracy":
tf.contrib.learn.MetricSpec(
metric_fn=tf.contrib.metrics.streaming_accuracy,
prediction_key=tf.contrib.learn.prediction_key.PredictionKey.
CLASSES)}
validation_monitor = tf.contrib.learn.monitors.ValidationMonitor(
x=X_test, y=y_test, early_stopping_rounds=50, metrics=validation_metrics)
输出:
prediction_key=tf.contrib.learn.prediction_key.PredictionKey.CLASSES)}
AttributeError: module 'tensorflow.contrib.learn' has no attribute 'prediction_key'
【问题讨论】:
-
您能否添加更多有关问题所在的详细信息,看看您是否可以减少重现错误所需的代码示例的大小?这将有助于我们更好地回答这个问题。
-
谢谢 - 减少原始问题中的代码。完整代码要点here
-
你用的是什么版本的tensorflow和python?
-
Python 3.6,为 GPU 启用了 TF '1.1.0-rc2'。
标签: tensorflow