summaryrefslogtreecommitdiff
path: root/decoder/hg_sampler.h
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2011-11-11 17:12:39 -0500
committerChris Dyer <cdyer@cs.cmu.edu>2011-11-11 17:12:39 -0500
commit105a52a8d37497fe69a01a7de771ef9b9300cd71 (patch)
treef20c4cc8bf31ccf1ce7204301bfa169c6fa080a7 /decoder/hg_sampler.h
parentb4fd470d2cb80b0c88d4210f7e5bb10d2aa4531d (diff)
optionally sample from forest to get training instances, rather than k-best it
Diffstat (limited to 'decoder/hg_sampler.h')
-rw-r--r--decoder/hg_sampler.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/decoder/hg_sampler.h b/decoder/hg_sampler.h
new file mode 100644
index 00000000..bf4e1eb0
--- /dev/null
+++ b/decoder/hg_sampler.h
@@ -0,0 +1,27 @@
+#ifndef _HG_SAMPLER_H_
+#define _HG_SAMPLER_H_
+
+
+#include <vector>
+#include "sparse_vector.h"
+#include "sampler.h"
+#include "wordid.h"
+
+class Hypergraph;
+
+struct HypergraphSampler {
+
+ struct Hypothesis {
+ std::vector<WordID> words;
+ SparseVector<double> fmap;
+ prob_t model_score; // log unnormalized probability
+ };
+
+ static void
+ sample_hypotheses(const Hypergraph& hg,
+ unsigned n, // how many samples to draw
+ MT19937* rng,
+ std::vector<Hypothesis>* hypos);
+};
+
+#endif