Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve keras model fit history afer execution interrupt

Tags:

python

keras

In a jupyter notebook, I'm doing a training in keras with a line similar to

history = model.fit(....., epoch=100)

When I see that var_loss converge I break manually the execution, and obviously history is not returned.

Is there a way to retrieve it? A member of model, or method, or a way to get the history object or its members?

like image 809
Mquinteiro Avatar asked Sep 03 '25 15:09

Mquinteiro


1 Answers

@Mquinteiro Try using a callback: https://keras.io/callbacks/. You could set the callback to terminate when the model is no longer improving (keras.callbacks.EarlyStopping) and then access the best model (save_best_only = True), or you could have the callback save checkpoints after each epoch (keras.callbacks.ModelCheckpoint) which you can access after manually stopping the execution.

like image 57
from keras import michael Avatar answered Sep 05 '25 16:09

from keras import michael