Show / Hide Table of Contents

Class ModelCheckpoint

Save the model after every epoch. filepath can contain named formatting options, which will be filled with the values of epoch and keys in logs(passed in on_epoch_end). For example: if filepath is weights.{epoch:02d}-{val_loss:.2f}.hdf5, then the model checkpoints will be saved with the epoch number and the validation loss in the filename.

Inheritance
System.Object
Keras
Base
Callback
ModelCheckpoint
Implements
System.IDisposable
Inherited Members
Base.Parameters
Base.None
Base.Init()
Base.ToPython()
Base.InvokeStaticMethod(Object, String, Dictionary<String, Object>)
Base.InvokeMethod(String, Dictionary<String, Object>)
Base.Item[String]
Keras.Instance
Keras.keras
Keras.keras2onnx
Keras.tfjs
Keras.Dispose()
Keras.ToTuple(Array)
Keras.ToList(Array)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Keras.Callbacks
Assembly: Keras.dll
Syntax
public class ModelCheckpoint : Callback, IDisposable

Constructors

| Improve this Doc View Source

ModelCheckpoint(String, String, Int32, Boolean, Boolean, String, Int32)

Initializes a new instance of the ModelCheckpoint class.

Declaration
public ModelCheckpoint(string filepath, string monitor = "val_loss", int verbose = 0, bool save_best_only = true, bool save_weights_only = false, string mode = "auto", int period = 1)
Parameters
Type Name Description
System.String filepath

string, path to save the model file.

System.String monitor

quantity to monitor.

System.Int32 verbose

verbosity mode, 0 or 1.

System.Boolean save_best_only

if save_best_only=True, the latest best model according to the quantity monitored will not be overwritten.

System.Boolean save_weights_only

if True, then only the model's weights will be saved (model.save_weights(filepath)), else the full model is saved (model.save(filepath)).

System.String mode

one of {auto, min, max}. If save_best_only=True, the decision to overwrite the current save file is made based on either the maximization or the minimization of the monitored quantity. For val_acc, this should be max, for val_loss this should be min, etc. In auto mode, the direction is automatically inferred from the name of the monitored quantity.

System.Int32 period

Interval (number of epochs) between checkpoints.

Implements

System.IDisposable
  • Improve this Doc
  • View Source
Back to top Generated by DocFX