MosesTuning::SparseVector Class Reference

#include <FeatureStats.h>

List of all members.

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
SparseVectoroperator-= (const SparseVector &rhs)
SparseVectoroperator+= (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)


Detailed Description

Definition at line 27 of file FeatureStats.h.


Member Typedef Documentation

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.


Member Function Documentation

void MosesTuning::SparseVector::clear (  ) 

Definition at line 79 of file FeatureStats.cpp.

Referenced by MosesTuning::FeatureStats::clear().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

FeatureStatsType MosesTuning::SparseVector::inner_product ( const SparseVector rhs  )  const

Definition at line 122 of file FeatureStats.cpp.

References get().

Referenced by MosesTuning::inner_product().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

std::size_t MosesTuning::SparseVector::size (  )  const [inline]

Definition at line 40 of file FeatureStats.h.

Referenced by MosesTuning::inner_product().

Here is the caller graph for this function:

void MosesTuning::SparseVector::write ( std::ostream &  out,
const std::string &  sep = " " 
) const

Referenced by main(), and MosesTuning::operator<<().

Here is the caller graph for this function:


Friends And Related Function Documentation

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.


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

Generated on Thu Jul 6 00:34:15 2017 for Moses by  doxygen 1.5.9