Reranker Framework (ReFr)
Reranking framework for structure prediction and discriminative language modeling
|
A class to hold the several feature vectors needed during training (especially for the perceptron family of algorithms), as well as for performing the updates to those feature vectors (again, with the perceptron family of algorithms in mind). More...
#include <training-vector-set.H>
Public Member Functions | |
TrainingVectorSet () | |
Constructs a new set of feature vectors (models) for use during training. More... | |
virtual | ~TrainingVectorSet () |
Destroys this instance. More... | |
const FeatureVector< int, double > & | weights () const |
Returns the "raw" feature weights computed during training. More... | |
const FeatureVector< int, double > & | average_weights () const |
Returns the feature vector corresponding to the averaged perceptron. More... | |
const FeatureVector< int, double > & | GetModel (bool raw) const |
Returns either the raw or averaged feature vector, depending on the argument. More... | |
template<typename Collection > | |
void | UpdateWeights (const Time &time, const Collection &feature_uids, const FeatureVector< int, double > &feature_vector, double scalar) |
Increments the weights for the specified collection of features. More... | |
template<typename Collection > | |
void | UpdateGoldAndCandidateFeatureAverages (const Time &time, const Collection &gold_feature_uids, const Collection &candidate_feature_uids) |
Updates the feature averages the specified pair of feature uid collections, one for a gold reference training instance and the other for a one-best hypothesis. More... | |
void | UpdateAllFeatureAverages (const Time &time) |
void | RemapFeatureUids (const unordered_map< int, int > &old_to_new_uids) |
Friends | |
class | PerceptronModelProtoReader |
ostream & | operator<< (ostream &os, const TrainingVectorSet &tvs) |
A class to hold the several feature vectors needed during training (especially for the perceptron family of algorithms), as well as for performing the updates to those feature vectors (again, with the perceptron family of algorithms in mind).
Definition at line 59 of file training-vector-set.H.
|
inline |
Constructs a new set of feature vectors (models) for use during training.
Definition at line 63 of file training-vector-set.H.
|
inlinevirtual |
Destroys this instance.
Definition at line 65 of file training-vector-set.H.
|
inline |
Returns the feature vector corresponding to the averaged perceptron.
Definition at line 74 of file training-vector-set.H.
|
inline |
Returns either the raw or averaged feature vector, depending on the argument.
raw | if true, return the raw model; otherwise, return the averaged perceptron model |
Definition at line 83 of file training-vector-set.H.
|
inline |
Definition at line 136 of file training-vector-set.H.
|
inline |
Definition at line 128 of file training-vector-set.H.
|
inline |
Updates the feature averages the specified pair of feature uid collections, one for a gold reference training instance and the other for a one-best hypothesis.
Definition at line 115 of file training-vector-set.H.
|
inline |
Increments the weights for the specified collection of features.
Technically, this method adds a scaled version of the specified vector projected into the subspace specified by the collection of feature uid's.
time | the current training time |
feature_uids | the set of features to be updated (essentially a subspace into which to project feature_vector ) |
feature_vector | the feature vector to be projected into the specified subspace, scaled and then added to the current set of model weights |
scalar | the amount by which to scale the specified subvector |
Definition at line 104 of file training-vector-set.H.
|
inline |
Returns the "raw" feature weights computed during training.
This is essentially the "most recent" perceptron created during training.
Definition at line 72 of file training-vector-set.H.
|
friend |
Definition at line 144 of file training-vector-set.H.
|
friend |
Definition at line 61 of file training-vector-set.H.