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

如何用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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 lammps拉伸应力应变曲线分析
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
    • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
    • ¥30 python代码,帮调试
    • ¥15 #MATLAB仿真#车辆换道路径规划
    • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
    • ¥15 数据可视化Python