Cloud ML Engine 上的超参数调整作业失败并显示错误消息:
Too many hyperparameter tuning metrics were written by Hyperparameter Tuning Trial #...
我该如何解决?
Cloud ML Engine 上的超参数调整作业失败并显示错误消息:
Too many hyperparameter tuning metrics were written by Hyperparameter Tuning Trial #...
我该如何解决?
首先检查以确保您确实没有写出太多的评估指标。您是否在 EvalSpec 中指定了适当的节流阀?
其次,检查损失指标。训练中的损失度量是否与评估中的损失度量相同?如果是这种情况,您的超参数调优工作就会被训练指标弄糊涂。
最简单的解决方法是定义一个新的评估指标并将该指标(在我的示例中为“rmse”)用作您的超参数标签。
这是一个显示这两个修复的示例:
# create metric for hyperparameter tuning
def my_rmse(labels, predictions):
pred_values = predictions['predictions']
return {'rmse': tf.metrics.root_mean_squared_error(labels, pred_values)}
# Create estimator to train and evaluate
def train_and_evaluate(output_dir):
estimator = tf.estimator.DNNLinearCombinedRegressor(...)
estimator = tf.contrib.estimator.add_metrics(estimator, my_rmse)
train_spec = ...
exporter = ...
eval_spec = tf.estimator.EvalSpec(
input_fn = ...,
start_delay_secs = 60, # start evaluating after N seconds
throttle_secs = 300, # evaluate every N seconds
exporters = exporter)
tf.estimator.train_and_evaluate(estimator, train_spec, eval_spec)