Reranker Framework (ReFr)
Reranking framework for structure prediction and discriminative language modeling
|
A class to construct a ModelMessage
from a PerceptronModel instance.
More...
#include <perceptron-model-proto-writer.H>
Public Member Functions | |
PerceptronModelProtoWriter () | |
Constructs a new instance that can serialize Model instances to ModelMessage protocol buffer messages. More... | |
virtual | ~PerceptronModelProtoWriter () |
Destroys this writer. More... | |
virtual void | Write (const Model *model, ModelMessage *model_message, bool write_features) const |
Serializes a PerceptronModel instance to a ModelMessage. More... | |
virtual void | WriteFeatures (const Model *model, ostream &os, bool output_best_epoch, double weight, bool output_key, const string separator) const |
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::ModelProtoWriter | |
ModelProtoWriter () | |
Constructs a new instance that can serialize Model instances to ModelMessage protocol buffer messages. More... | |
virtual | ~ModelProtoWriter () |
Destroys this writer. More... | |
Public Member Functions inherited from reranker::FactoryConstructible | |
virtual | ~FactoryConstructible () |
virtual void | RegisterInitializers (Initializers &initializers) |
virtual void | Init (const Environment *env, const string &arg) |
A class to construct a ModelMessage
from a PerceptronModel instance.
TODO(dbikel): Need some kind of a factory for model writers, so the proper ModelProtoWriter gets instantiated given a particular Model subclass.
Definition at line 58 of file perceptron-model-proto-writer.H.
|
inline |
Constructs a new instance that can serialize Model instances to ModelMessage protocol buffer messages.
Definition at line 62 of file perceptron-model-proto-writer.H.
|
inlinevirtual |
Destroys this writer.
Definition at line 64 of file perceptron-model-proto-writer.H.
|
virtual |
Serializes a PerceptronModel instance to a ModelMessage.
When the write_features
parameter is true
, the feature vectors written out will be those of the best model epoch (typically the epoch with the lowest average devtest loss).
model | the PerceptronModel to be serialized to the specified ModelMessage |
model_message | the ModelMessage to be filled in by this method with the serialized version of the specified Model |
write_features | whether the features of the specified Model should be written out |
Implements reranker::ModelProtoWriter.
Definition at line 52 of file perceptron-model-proto-writer.C.
|
virtual |
Writes out the features of this model to a series of FeatureMessage
instances using the specified ConfusionProtoIO
instance.
This method writes out both the raw feature values as well as the averaged values; however, the averaged values are stored in the avg_value field of the FeatureMessage object. In contrast to the behavior of the Write method, the features written out by this method will be those of the current model, as opposed to those of the best model.
model | the PerceptronModel to be serialized to the specified ModelMessage |
os | the output stream to which to write features |
output_best_epoch | output the weights of the best epoch of training, as opposed to the most recent epoch |
weight | the weight by which all feature weights should be multiplied before being output |
output_key | output the key (feature name) and separator for each feature |
separator | the separator string to output between each feature’s key and its base64-encoded FeatureMessage (only used if output_key == True) |
Implements reranker::ModelProtoWriter.
Definition at line 95 of file perceptron-model-proto-writer.C.