public class LocalFileGraphSaver extends java.lang.Object implements EarlyStoppingModelSaver<ComputationGraph>
ComputationGraph
s learned during early stopping training to the local file system.Constructor and Description |
---|
LocalFileGraphSaver(java.lang.String directory)
Constructor that uses default character set for configuration (json) encoding
|
LocalFileGraphSaver(java.lang.String directory,
java.nio.charset.Charset encoding) |
Modifier and Type | Method and Description |
---|---|
ComputationGraph |
getBestModel()
Retrieve the best model that was previously saved
|
ComputationGraph |
getLatestModel()
Retrieve the most recent model that was previously saved
|
void |
saveBestModel(ComputationGraph net,
double score)
Save the best model (so far) learned during early stopping training
|
void |
saveLatestModel(ComputationGraph net,
double score)
Save the latest (most recent) model learned during early stopping
|
java.lang.String |
toString() |
public LocalFileGraphSaver(java.lang.String directory)
directory
- Directory to save networkspublic LocalFileGraphSaver(java.lang.String directory, java.nio.charset.Charset encoding)
directory
- Directory to save networksencoding
- Character encoding for configuration (json)public void saveBestModel(ComputationGraph net, double score) throws java.io.IOException
EarlyStoppingModelSaver
saveBestModel
in interface EarlyStoppingModelSaver<ComputationGraph>
java.io.IOException
public void saveLatestModel(ComputationGraph net, double score) throws java.io.IOException
EarlyStoppingModelSaver
saveLatestModel
in interface EarlyStoppingModelSaver<ComputationGraph>
java.io.IOException
public ComputationGraph getBestModel() throws java.io.IOException
EarlyStoppingModelSaver
getBestModel
in interface EarlyStoppingModelSaver<ComputationGraph>
java.io.IOException
public ComputationGraph getLatestModel() throws java.io.IOException
EarlyStoppingModelSaver
getLatestModel
in interface EarlyStoppingModelSaver<ComputationGraph>
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object