summaryrefslogtreecommitdiff
path: root/utils/weights.h
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2011-09-13 13:25:46 +0100
committerChris Dyer <cdyer@cs.cmu.edu>2011-09-13 13:25:46 +0100
commit38a5bee71f6b49515cd105a9467ff602ff9dee64 (patch)
tree9e17da6cf072beb0150d82fee1d8e4756c8f0253 /utils/weights.h
parentb09ca8a5e6f5e8c1840e51a93c9f8e6b8c4bcc33 (diff)
optional support for doing perfect hashing of feature strings to save lots of memory
Diffstat (limited to 'utils/weights.h')
-rw-r--r--utils/weights.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/utils/weights.h b/utils/weights.h
index cc20283c..7664810b 100644
--- a/utils/weights.h
+++ b/utils/weights.h
@@ -2,21 +2,23 @@
#define _WEIGHTS_H_
#include <string>
-#include <map>
#include <vector>
#include "sparse_vector.h"
+// warning: in the future this will become float
+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<double>* w) const;
- void InitSparseVector(SparseVector<double>* w) const;
- void InitFromVector(const std::vector<double>& w);
- void InitFromVector(const SparseVector<double>& w);
+ 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);
private:
- std::vector<double> wv_;
+ std::vector<weight_t> wv_;
};
#endif