Reranker Framework (ReFr)
Reranking framework for structure prediction and discriminative language modeling
|
An end-of-epoch hook for writing out the best model so far to file after each epoch (if the best model changes from the last time it was written out). More...
#include <model-proto-writer.H>
Public Member Functions | |
EndOfEpochModelWriter (const string &model_file, shared_ptr< ModelProtoWriter > writer, bool compressed, bool use_base64, bool verbose=true) | |
Constructs a new instance to write out the best model to the specified file. More... | |
virtual void | Do (Model *model) |
Executes this end-of-epoch hook, which writes out the best model so far if its epoch differs from that of the last model written out by this hook. More... | |
Public Member Functions inherited from reranker::Model::Hook | |
virtual | ~Hook () |
An end-of-epoch hook for writing out the best model so far to file after each epoch (if the best model changes from the last time it was written out).
Definition at line 126 of file model-proto-writer.H.
|
inline |
Constructs a new instance to write out the best model to the specified file.
A model will only be serialized if the best model epoch so far is different from that of the last model written out by this hook.
model_file | the name of the file to which to serialize a Model |
writer | the serializer for serializing a Model to a ModelMessage |
compressed | whether to use compression when serializing a Model |
use_base64 | whether to serialize using base64 encoding |
verbose | whether this end-of-epoch hook should be verbose |
Definition at line 142 of file model-proto-writer.H.
|
inlinevirtual |
Executes this end-of-epoch hook, which writes out the best model so far if its epoch differs from that of the last model written out by this hook.
For safety, the model will be first serialized to a temporary file and then moved into place.
model | the model that will execute this hook in its Model::EndOfEpoch method |
Implements reranker::Model::Hook.
Definition at line 160 of file model-proto-writer.H.