Class CheckpointListener.Builder
- java.lang.Object
-
- org.deeplearning4j.optimize.listeners.CheckpointListener.Builder
-
- Enclosing class:
- CheckpointListener
public static class CheckpointListener.Builder extends Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CheckpointListenerbuild()CheckpointListener.BuilderdeleteExisting(boolean deleteExisting)If the checkpoint listener is set to save to a non-empty directory, should the CheckpointListener-related content be deleted?
This is disabled by default (and instead, an exception will be thrown if existing data is found)
WARNING: Be careful when enabling this, as it deletes all saved checkpoint models in the specified directory!CheckpointListener.BuilderkeepAll()Keep all model checkpoints - i.e., don't delete any.CheckpointListener.BuilderkeepLast(int n)Keep only the last N most recent model checkpoint files.CheckpointListener.BuilderkeepLastAndEvery(int nLast, int everyN)Keep the last N most recent model checkpoint files, and every M checkpoint files.
For example: suppose you save every 100 iterations, for 2050 iteration, and use keepLastAndEvery(3,5).CheckpointListener.BuilderlogSaving(boolean logSaving)If true (the default) log a message every time a model is savedCheckpointListener.BuildersaveEvery(long amount, TimeUnit timeUnit)Save a model periodicallyCheckpointListener.BuildersaveEvery(long amount, TimeUnit timeUnit, boolean sinceLast)Save a model periodically (if sinceLast == false), or if the specified amount of time has elapsed since the last model was saved (if sinceLast == true)CheckpointListener.BuildersaveEveryEpoch()Save a model at the end of every epochCheckpointListener.BuildersaveEveryNEpochs(int n)Save a model at the end of every N epochsCheckpointListener.BuildersaveEveryNIterations(int n)Save a model every N iterationsCheckpointListener.BuildersaveEveryNIterations(int n, boolean sinceLast)Save a model every N iterations (if sinceLast == false), or if N iterations have passed since the last model vas saved (if sinceLast == true)
-
-
-
Method Detail
-
saveEveryEpoch
public CheckpointListener.Builder saveEveryEpoch()
Save a model at the end of every epoch
-
saveEveryNEpochs
public CheckpointListener.Builder saveEveryNEpochs(int n)
Save a model at the end of every N epochs
-
saveEveryNIterations
public CheckpointListener.Builder saveEveryNIterations(int n)
Save a model every N iterations
-
saveEveryNIterations
public CheckpointListener.Builder saveEveryNIterations(int n, boolean sinceLast)
Save a model every N iterations (if sinceLast == false), or if N iterations have passed since the last model vas saved (if sinceLast == true)
-
saveEvery
public CheckpointListener.Builder saveEvery(long amount, TimeUnit timeUnit)
Save a model periodically- Parameters:
amount- Quantity of the specified time unittimeUnit- Time unit
-
saveEvery
public CheckpointListener.Builder saveEvery(long amount, TimeUnit timeUnit, boolean sinceLast)
Save a model periodically (if sinceLast == false), or if the specified amount of time has elapsed since the last model was saved (if sinceLast == true)- Parameters:
amount- Quantity of the specified time unittimeUnit- Time unit
-
keepAll
public CheckpointListener.Builder keepAll()
Keep all model checkpoints - i.e., don't delete any. Note that this is the default.
-
keepLast
public CheckpointListener.Builder keepLast(int n)
Keep only the last N most recent model checkpoint files. Older checkpoints will automatically be deleted.- Parameters:
n- Number of most recent checkpoints to keep
-
keepLastAndEvery
public CheckpointListener.Builder keepLastAndEvery(int nLast, int everyN)
Keep the last N most recent model checkpoint files, and every M checkpoint files.
For example: suppose you save every 100 iterations, for 2050 iteration, and use keepLastAndEvery(3,5). This means after 2050 iterations you would have saved 20 checkpoints - some of which will be deleted. Those remaining in this example: iterations 500, 1000, 1500, 1800, 1900, 2000.- Parameters:
nLast- Most recent checkpoints to keepeveryN- Every N checkpoints to keep (regardless of age)
-
logSaving
public CheckpointListener.Builder logSaving(boolean logSaving)
If true (the default) log a message every time a model is saved- Parameters:
logSaving- Whether checkpoint saves should be logged or not
-
deleteExisting
public CheckpointListener.Builder deleteExisting(boolean deleteExisting)
If the checkpoint listener is set to save to a non-empty directory, should the CheckpointListener-related content be deleted?
This is disabled by default (and instead, an exception will be thrown if existing data is found)
WARNING: Be careful when enabling this, as it deletes all saved checkpoint models in the specified directory!
-
build
public CheckpointListener build()
-
-