diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2011-09-13 17:36:23 +0100 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2011-09-13 17:36:23 +0100 |
commit | 251da4347ea356f799e6c227ac8cf541c0cef2f2 (patch) | |
tree | 407e647e34aa89049754d83e9e1eb2cddff05de8 /utils/weights.h | |
parent | 75bff8e374f3cdcf3dc141f8b7b37858d0611234 (diff) |
get rid of bad Weights class so it no longer keeps a copy of a vector inside it
Diffstat (limited to 'utils/weights.h')
-rw-r--r-- | utils/weights.h | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/utils/weights.h b/utils/weights.h index 7664810b..30f71db0 100644 --- a/utils/weights.h +++ b/utils/weights.h @@ -10,15 +10,21 @@ typedef double weight_t; class Weights { public: - Weights() {} - void InitFromFile(const std::string& fname, std::vector<std::string>* feature_list = NULL); - void WriteToFile(const std::string& fname, bool hide_zero_value_features = true, const std::string* extra = NULL) const; - void InitVector(std::vector<weight_t>* w) const; - void InitSparseVector(SparseVector<weight_t>* w) const; - void InitFromVector(const std::vector<weight_t>& w); - void InitFromVector(const SparseVector<weight_t>& w); + static void InitFromFile(const std::string& fname, + std::vector<weight_t>* weights, + std::vector<std::string>* feature_list = NULL); + static void WriteToFile(const std::string& fname, + const std::vector<weight_t>& weights, + bool hide_zero_value_features = true, + const std::string* extra = NULL); + static void InitSparseVector(const std::vector<weight_t>& dv, + SparseVector<weight_t>* sv); + // check for infinities, NaNs, etc + static void SanityCheck(const std::vector<weight_t>& w); + // write weights with largest magnitude to cerr + static void ShowLargestFeatures(const std::vector<weight_t>& w); private: - std::vector<weight_t> wv_; + Weights(); }; #endif |