keras: how to save the training history attribute of the history object

前端 未结 8 2056
小鲜肉
小鲜肉 2020-12-12 23:43

In Keras, we can return the output of model.fit to a history as follows:

 history = model.fit(X_train, y_train, 
                     batch_size         


        
8条回答
  •  心在旅途
    2020-12-13 00:02

    The model history can be saved into a file as follows

    import json
    hist = model.fit(X_train, y_train, epochs=5, batch_size=batch_size,validation_split=0.1)
    with open('file.json', 'w') as f:
        json.dump(hist.history, f)
    

提交回复
热议问题