Reranker Framework (ReFr)
Reranking framework for structure prediction and discriminative language modeling
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
reranker::EndOfEpochModelWriter Class Reference

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>

Inheritance diagram for reranker::EndOfEpochModelWriter:
reranker::Model::Hook

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 ()
 

Detailed Description

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).

See Also
Model::set_end_of_epoch_hook

Definition at line 126 of file model-proto-writer.H.

Constructor & Destructor Documentation

reranker::EndOfEpochModelWriter::EndOfEpochModelWriter ( const string &  model_file,
shared_ptr< ModelProtoWriter writer,
bool  compressed,
bool  use_base64,
bool  verbose = true 
)
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.

Parameters
model_filethe name of the file to which to serialize a Model
writerthe serializer for serializing a Model to a ModelMessage
compressedwhether to use compression when serializing a Model
use_base64whether to serialize using base64 encoding
verbosewhether this end-of-epoch hook should be verbose
See Also
Model::set_end_of_epoch_hook

Definition at line 142 of file model-proto-writer.H.

Member Function Documentation

virtual void reranker::EndOfEpochModelWriter::Do ( Model model)
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.

Parameters
modelthe model that will execute this hook in its Model::EndOfEpoch method
See Also
Model::set_end_of_epoch_hook

Implements reranker::Model::Hook.

Definition at line 160 of file model-proto-writer.H.


The documentation for this class was generated from the following file: