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::ModelProtoWriter Class Referenceabstract

A class to construct a ModelMessage from a Model instance. More...

#include <model-proto-writer.H>

Inheritance diagram for reranker::ModelProtoWriter:
reranker::FactoryConstructible reranker::PerceptronModelProtoWriter

Public Member Functions

 ModelProtoWriter ()
 Constructs a new instance that can serialize Model instances to ModelMessage protocol buffer messages. More...
 
virtual ~ModelProtoWriter ()
 Destroys this writer. More...
 
virtual void Write (const Model *model, ModelMessage *model_message, bool write_features=true) const =0
 Serializes a Model instance to a ModelMessage. More...
 
virtual void WriteFeatures (const Model *model, ostream &os, bool output_best_epoch=false, double weight=1.0, bool output_key=false, const string separator="\t") const =0
 Writes out the features of this model to a series of FeatureMessage instances using the specified ConfusionProtoIO instance. More...
 
- Public Member Functions inherited from reranker::FactoryConstructible
virtual ~FactoryConstructible ()
 
virtual void RegisterInitializers (Initializers &initializers)
 
virtual void Init (const Environment *env, const string &arg)
 

Detailed Description

A class to construct a ModelMessage from a Model instance.

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

Constructor & Destructor Documentation

reranker::ModelProtoWriter::ModelProtoWriter ( )
inline

Constructs a new instance that can serialize Model instances to ModelMessage protocol buffer messages.

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

virtual reranker::ModelProtoWriter::~ModelProtoWriter ( )
inlinevirtual

Destroys this writer.

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

Member Function Documentation

virtual void reranker::ModelProtoWriter::Write ( const Model model,
ModelMessage *  model_message,
bool  write_features = true 
) const
pure virtual

Serializes a Model instance to a ModelMessage.

Parameters
modelthe Model to be serialized to the specified ModelMessage
model_messagethe ModelMessage to be filled in by this method with the serialized version of the specified Model
write_featureswhether the features of the specified Model should be written out

Implemented in reranker::PerceptronModelProtoWriter.

virtual void reranker::ModelProtoWriter::WriteFeatures ( const Model model,
ostream &  os,
bool  output_best_epoch = false,
double  weight = 1.0,
bool  output_key = false,
const string  separator = "\t" 
) const
pure virtual

Writes out the features of this model to a series of FeatureMessage instances using the specified ConfusionProtoIO instance.

Parameters
modelthe Model to be serialized to the specified ModelMessage
osthe output stream to which to write features
output_best_epochoutput the weights of the best epoch of training, as opposed to the most recent epoch
weightthe weight by which all feature weights should be multiplied before being output
output_keyoutput the key (feature name) and separator for each feature
separatorthe separator string to output between each feature’s key and its base64-encoded FeatureMessage (only used if output_key == True)

Implemented in reranker::PerceptronModelProtoWriter.


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