#include <FeatureStats.h>
Public Types | |
typedef std::map< std::size_t, FeatureStatsType > | fvector_t |
typedef std::map< std::string, std::size_t > | name2id_t |
typedef std::vector< std::string > | id2name_t |
Public Member Functions | |
FeatureStatsType | get (const std::string &name) const |
FeatureStatsType | get (std::size_t id) const |
void | set (const std::string &name, FeatureStatsType value) |
void | set (size_t id, FeatureStatsType value) |
void | clear () |
void | load (const std::string &file) |
std::size_t | size () const |
void | write (std::ostream &out, const std::string &sep=" ") const |
SparseVector & | operator-= (const SparseVector &rhs) |
SparseVector & | operator+= (const SparseVector &rhs) |
FeatureStatsType | inner_product (const SparseVector &rhs) const |
std::vector< std::size_t > | feats () const |
Static Public Member Functions | |
static std::size_t | encode (const std::string &feat) |
static std::string | decode (std::size_t feat) |
Friends | |
bool | operator== (SparseVector const &item1, SparseVector const &item2) |
std::size_t | hash_value (SparseVector const &item) |
Definition at line 27 of file FeatureStats.h.
typedef std::map<std::size_t,FeatureStatsType> MosesTuning::SparseVector::fvector_t |
Definition at line 30 of file FeatureStats.h.
typedef std::vector<std::string> MosesTuning::SparseVector::id2name_t |
Definition at line 32 of file FeatureStats.h.
typedef std::map<std::string, std::size_t> MosesTuning::SparseVector::name2id_t |
Definition at line 31 of file FeatureStats.h.
void MosesTuning::SparseVector::clear | ( | ) |
Definition at line 79 of file FeatureStats.cpp.
Referenced by MosesTuning::FeatureStats::clear().
std::string MosesTuning::SparseVector::decode | ( | std::size_t | feat | ) | [static] |
Definition at line 173 of file FeatureStats.cpp.
std::size_t MosesTuning::SparseVector::encode | ( | const std::string & | feat | ) | [static] |
Definition at line 159 of file FeatureStats.cpp.
Referenced by MosesTuning::InitialiseWeights().
std::vector< std::size_t > MosesTuning::SparseVector::feats | ( | ) | const |
Definition at line 148 of file FeatureStats.cpp.
FeatureStatsType MosesTuning::SparseVector::get | ( | std::size_t | id | ) | const |
FeatureStatsType MosesTuning::SparseVector::get | ( | const std::string & | name | ) | const |
Referenced by BOOST_AUTO_TEST_CASE(), inner_product(), and MosesTuning::MiraFeatureVector::MiraFeatureVector().
FeatureStatsType MosesTuning::SparseVector::inner_product | ( | const SparseVector & | rhs | ) | const |
Definition at line 122 of file FeatureStats.cpp.
References get().
Referenced by MosesTuning::inner_product().
void MosesTuning::SparseVector::load | ( | const std::string & | file | ) |
SparseVector & MosesTuning::SparseVector::operator+= | ( | const SparseVector & | rhs | ) |
Definition at line 102 of file FeatureStats.cpp.
SparseVector & MosesTuning::SparseVector::operator-= | ( | const SparseVector & | rhs | ) |
Definition at line 112 of file FeatureStats.cpp.
void MosesTuning::SparseVector::set | ( | size_t | id, | |
FeatureStatsType | value | |||
) |
Definition at line 64 of file FeatureStats.cpp.
void MosesTuning::SparseVector::set | ( | const std::string & | name, | |
FeatureStatsType | value | |||
) |
Referenced by BOOST_AUTO_TEST_CASE(), MosesTuning::AvgWeightVector::ToSparse(), and MosesTuning::MiraWeightVector::ToSparse().
std::size_t MosesTuning::SparseVector::size | ( | ) | const [inline] |
Definition at line 40 of file FeatureStats.h.
Referenced by MosesTuning::inner_product().
void MosesTuning::SparseVector::write | ( | std::ostream & | out, | |
const std::string & | sep = " " | |||
) | const |
std::size_t hash_value | ( | SparseVector const & | item | ) | [friend] |
Definition at line 184 of file FeatureStats.cpp.
bool operator== | ( | SparseVector const & | item1, | |
SparseVector const & | item2 | |||
) | [friend] |
Definition at line 178 of file FeatureStats.cpp.