好消息!
tf.estimator现在已经在master上提供了早期停止支持,并且看起来将在1.10中。
estimator = tf.estimator.Estimator(model_fn, model_dir)os.makedirs(estimator.eval_dir()) # TODO This should not be expected IMO.early_stopping = tf.contrib.estimator.stop_if_no_decrease_hook( estimator, metric_name='loss', max_steps_without_decrease=1000, min_steps=100)tf.estimator.train_and_evaluate( estimator, train_spec=tf.estimator.TrainSpec(train_input_fn, hooks=[early_stopping]), eval_spec=tf.estimator.evalSpec(eval_input_fn))



