diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-06 18:11:34 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-06 18:11:34 +0000 |
commit | 704052fecfb16f2e9074bace99936a566f9d84ab (patch) | |
tree | 4908d9cdff5b02bbba3666e1ebf6bca56186fcad /decoder/hg.cc | |
parent | 386138659cbae6647735d1bbf78fef1c29fb4561 (diff) |
epsilon distance for pruning - should alter density
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@159 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/hg.cc')
-rw-r--r-- | decoder/hg.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/decoder/hg.cc b/decoder/hg.cc index 7fc9643d..50f61865 100644 --- a/decoder/hg.cc +++ b/decoder/hg.cc @@ -177,6 +177,8 @@ void Hypergraph::PruneEdges(const std::vector<bool>& prune_edge, bool run_inside void Hypergraph_finish_prune(Hypergraph &hg,vector<prob_t> const& io,double cutoff,vector<bool> const* preserve_mask,bool verbose=false) { + const double EPSILON=1e-5; + cutoff=cutoff-EPSILON; // vector<bool> prune(hg.NumberOfEdges()); if (verbose) { if (preserve_mask) cerr << preserve_mask->size() << " " << prune.size() << endl; @@ -210,9 +212,10 @@ void Hypergraph::DensityPruneInsideOutside(const double scale, return; } vector<prob_t> io(edges_.size()); - if (use_sum_prod_semiring) + if (use_sum_prod_semiring) { ComputeEdgePosteriors(scale, &io); - else + assert(scale > 0.0); + } else ComputeBestPathThroughEdges(&io); assert(edges_.size() == io.size()); vector<prob_t> sorted = io; @@ -225,12 +228,12 @@ void Hypergraph::BeamPruneInsideOutside( const bool use_sum_prod_semiring, const double alpha, const vector<bool>* preserve_mask) { - assert(alpha > 0.0); - assert(scale > 0.0); + assert(alpha >= 0.0); vector<prob_t> io(edges_.size()); - if (use_sum_prod_semiring) + if (use_sum_prod_semiring) { ComputeEdgePosteriors(scale, &io); - else + assert(scale > 0.0); + } else ComputeBestPathThroughEdges(&io); assert(edges_.size() == io.size()); prob_t best; // initializes to zero |