CodeDog007 2019-05-21 18:06
浏览 879

如何用BestExporter保存的最优模型验证测试集。

我训练了一个带early stopping的模型,用BestExporter保存最优模型,如何导出最优模型并且读取用测试集验证auc?

exporter = tf.estimator.BestExporter(
      name="best_exporter",
      serving_input_receiver_fn=serving_input_fn,
      exports_to_keep=5) # this will keep the 5 best checkpoints
os.makedirs(model.eval_dir())
early_stopping = tf.contrib.estimator.stop_if_no_increase_hook(model, metric_name='eval_auc', max_steps_without_increase=20000, run_every_secs=400)
train_spec = tf.estimator.TrainSpec(input_fn=make_input_fn('/hdfs/user/reco/sample_v1', 10), hooks=[early_stopping])
eval_spec = tf.estimator.EvalSpec(input_fn=make_evaluate_input_fn(), exporters=exporter, throttle_secs=120)
tf.estimator.train_and_evaluate(model, train_spec, eval_spec)
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!
    • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
    • ¥15 求daily translation(DT)偏差订正方法的代码