#include <MiraWeightVector.h>
Public Member Functions | |
MiraWeightVector () | |
MiraWeightVector (const std::vector< ValType > &init) | |
void | update (const MiraFeatureVector &fv, float tau) |
void | tick () |
ValType | score (const MiraFeatureVector &fv) const |
ValType | sqrNorm () const |
AvgWeightVector | avg () |
void | ToSparse (SparseVector *sparse, size_t denseSize) const |
Friends | |
class | AvgWeightVector |
std::ostream & | operator<< (std::ostream &o, const MiraWeightVector &e) |
Definition at line 24 of file MiraWeightVector.h.
MosesTuning::MiraWeightVector::MiraWeightVector | ( | ) |
Constructor, initializes to the zero vector
Definition at line 14 of file MiraWeightVector.cpp.
MosesTuning::MiraWeightVector::MiraWeightVector | ( | const std::vector< ValType > & | init | ) |
Constructor with provided initial vector
init | Initial feature values |
AvgWeightVector MosesTuning::MiraWeightVector::avg | ( | ) |
Return an averaged view of this weight vector
Definition at line 71 of file MiraWeightVector.cpp.
References AvgWeightVector.
ValType MosesTuning::MiraWeightVector::score | ( | const MiraFeatureVector & | fv | ) | const |
Score a feature vector according to the model
fv | Feature vector to be scored |
Definition at line 59 of file MiraWeightVector.cpp.
References MosesTuning::MiraFeatureVector::feat(), MosesTuning::MiraFeatureVector::size(), and MosesTuning::MiraFeatureVector::val().
Referenced by MosesTuning::NbestHopeFearDecoder::HopeFear().
ValType MosesTuning::MiraWeightVector::sqrNorm | ( | ) | const |
Squared norm of the weight vector
Definition at line 131 of file MiraWeightVector.cpp.
void MosesTuning::MiraWeightVector::tick | ( | ) |
Perform an empty update (affects averaging)
Definition at line 50 of file MiraWeightVector.cpp.
void MosesTuning::MiraWeightVector::ToSparse | ( | SparseVector * | sparse, | |
size_t | denseSize | |||
) | const |
Convert to sparse vector, interpreting all features as sparse. Only used by hgmira.
Definition at line 96 of file MiraWeightVector.cpp.
References MosesTuning::SparseVector::set().
void MosesTuning::MiraWeightVector::update | ( | const MiraFeatureVector & | fv, | |
float | tau | |||
) |
Update a the model
fv | Feature vector to be added to the weights | |
tau | FV will be scaled by this value before update |
Definition at line 39 of file MiraWeightVector.cpp.
References MosesTuning::MiraFeatureVector::feat(), MosesTuning::MiraFeatureVector::size(), update(), and MosesTuning::MiraFeatureVector::val().
Referenced by update().
friend class AvgWeightVector [friend] |
std::ostream& operator<< | ( | std::ostream & | o, | |
const MiraWeightVector & | e | |||
) | [friend] |