Riley Fitzpatrick
Riley Fitzpatrick

Reputation: 919

When training neural networks, does Tensorflow automatically revert back to the best epoch after finishing?

If not, why not? Sometimes I will have an epoch that gets 95ish % and then finish with an epoch that has 10% or so less accuracy. I just never can tell whether it reverts back to that best epoch.

Upvotes: 0

Views: 198

Answers (2)

ramu gantala
ramu gantala

Reputation: 21

keras.callbacks.ModelCheckpoint(filepath, monitor='val_loss', verbose=0, save_best_only=True, save_weights_only=False, mode='auto', period=1)

Upvotes: 0

venkata krishnan
venkata krishnan

Reputation: 2046

if you are using Keras,then in ModelCheckpoint callback, set save_best_only=True. If this option is enabled, then it saves the model which shows the best results based on the metric you set, either loss or accuracy which you mention for monitor attribute.

Read more about it here - https://keras.io/callbacks/#modelcheckpoint

Upvotes: 3

Related Questions