summaryrefslogtreecommitdiff
path: root/training/entropy.h
diff options
context:
space:
mode:
authorPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-07-08 14:26:51 +0200
committerPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-07-08 14:26:51 +0200
commitc139ce495861bb341e1b86a85ad4559f9ad53c14 (patch)
tree1071839ee458f21f169ce06fc536fefe07e4c65d /training/entropy.h
parent3a94ac22e5c60aa205f2b3dadf81b0666500e0c3 (diff)
parentd01e5b66d3010d61b9b56301fd7f302dd4ea5bc8 (diff)
Merge branch 'master' of github.com:pks/cdec-dtrain
Diffstat (limited to 'training/entropy.h')
-rw-r--r--training/entropy.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/training/entropy.h b/training/entropy.h
new file mode 100644
index 00000000..796589ca
--- /dev/null
+++ b/training/entropy.h
@@ -0,0 +1,22 @@
+#ifndef _CSENTROPY_H_
+#define _CSENTROPY_H_
+
+#include <vector>
+#include "sparse_vector.h"
+
+namespace training {
+ class CandidateSet;
+
+ class CandidateSetEntropy {
+ public:
+ explicit CandidateSetEntropy(const CandidateSet& cs) : cands_(cs) {}
+ // compute the entropy (expected log likelihood) of a CandidateSet
+ // (optional) the gradient of the entropy with respect to params
+ double operator()(const std::vector<double>& params,
+ SparseVector<double>* g = NULL) const;
+ private:
+ const CandidateSet& cands_;
+ };
+};
+
+#endif