在 tensorflow r0.9 (skflow) 中训练 DNNClassifier 时如何打印进度?

How to print progress when training a DNNClassifier in tensorflow r0.9 (skflow)?

我无法理解 DNNClassifier 在训练时打印进度,即损失和验证分数。据我所知,可以使用从 BaseEstimator 继承的配置参数打印损失,但是当我传递一个 RunConfig 对象时,分类器没有打印任何东西。

from tensorflow.contrib.learn.python.learn.estimators import run_config

config = run_config.RunConfig(verbose=1)
classifier = learn.DNNClassifier(hidden_units=[10, 20, 10],
                             n_classes=3,
                             config=config)
classifier.fit(X_train, y_train, steps=1000)

我错过了什么吗?我检查了 RunConfig 如何处理详细参数,它似乎 that it only cares if its greater than 1,与文档不匹配:

verbose: Controls the verbosity, possible values: 0: the algorithm and debug information is muted. 1: trainer prints the progress. 2: log device placement is printed.

至于验证分数,我认为使用 monitors.ValidationMonitor 会很好,但是当尝试时,分类器不打印任何东西,当尝试使用 early_stopping_rounds 时也没有任何反应。我在源代码中搜索文档或一些注释,但找不到任何监视器。

在拟合函数显示进度之前添加这些:

import logging
logging.getLogger().setLevel(logging.INFO)

样本:

INFO:tensorflow:global_step/sec: 0
INFO:tensorflow:Training steps [0,1000000)
INFO:tensorflow:Step 1: loss = 10.5043
INFO:tensorflow:training step 100, loss = 10.45380 (0.223 sec/batch).
INFO:tensorflow:Step 101: loss = 10.5623
INFO:tensorflow:training step 200, loss = 10.46701 (0.220 sec/batch).
INFO:tensorflow:Step 201: loss = 10.3885
INFO:tensorflow:training step 300, loss = 10.36501 (0.232 sec/batch).
INFO:tensorflow:Step 301: loss = 10.3441
INFO:tensorflow:training step 400, loss = 10.44571 (0.220 sec/batch).
INFO:tensorflow:Step 401: loss = 10.396
INFO:tensorflow:global_step/sec: 3.95

在训练之前添加这一行:

import logging
tf.logging.set_verbosity(tf.logging.INFO)