View source: R/help_functions.R
remove_checkpoints | R Documentation |
Remove all but n 'best' checkpoints, based on some condition. Condition can be accuracy, loss or epoch number.
remove_checkpoints(
cp_dir,
metric = "acc",
best_n = 1,
ask_before_remove = TRUE
)
cp_dir |
Directory containing checkpoints. |
metric |
Either |
best_n |
Number of checkpoints to keep. |
ask_before_remove |
Whether to show files to keep before deleting rest. |
None. Deletes certain files.
model <- create_model_lstm_cnn(layer_lstm = 8)
checkpoint_folder <- tempfile()
dir.create(checkpoint_folder)
keras::save_model_hdf5(model, file.path(checkpoint_folder, 'Ep.007-val_loss11.07-val_acc0.6.hdf5'))
keras::save_model_hdf5(model, file.path(checkpoint_folder, 'Ep.019-val_loss8.74-val_acc0.7.hdf5'))
keras::save_model_hdf5(model, file.path(checkpoint_folder, 'Ep.025-val_loss0.03-val_acc0.8.hdf5'))
remove_checkpoints(cp_dir = checkpoint_folder, metric = "acc", best_n = 2,
ask_before_remove = FALSE)
list.files(checkpoint_folder)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.