summaryrefslogtreecommitdiff
path: root/utils/weights.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/weights.h')
-rw-r--r--utils/weights.h22
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