【问题标题】:Tensorflow: method to save and restore TensorFlowEstimator()TensorFlow:保存和恢复 TensorFlowEstimator() 的方法
【发布时间】:2016-10-09 18:28:04
【问题描述】:

如何保存和加载这个对象(regressor)?

from tensorflow.contrib import learn
regressor = learn.TensorFlowEstimator()

我无法使用 tensorflow 的默认 Saver() 来保存它。

如何使用此模型进行增量学习?我对其构造函数中的continue_training 参数感到困惑。它说你可以用新数据一次又一次地调用 fit。同时提供partial_fit()。请帮我理解?

【问题讨论】:

    标签: python python-3.x machine-learning tensorflow lstm


    【解决方案1】:

    根据这个TF tutorial,以下应该可以工作:

    保存:

    regressor.save('/tmp/tf_examples/my_model_1/')
    

    用于恢复:

    new_regressor = TensorFlowEstimator.restore('/tmp/tf_examples/my_model_2')
    

    对于增量训练:请参阅以下详细信息。他们给出了很好的解释。

    continue_training - 将此设置为True,模型初始化一次,它将在每次拟合调用时持续训练。

    partial_fit - 增量拟合一批样本

    【讨论】:

    • 谢谢,它解决了我的问题。你能帮我解决我的第二个疑问吗(声明已更新)。
    猜你喜欢
    • 1970-01-01
    • 2016-04-02
    • 1970-01-01
    • 1970-01-01
    • 2016-08-16
    • 1970-01-01
    • 2018-04-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多