From 74bdfce7e86d69f1a03ad1dcdf4711838285f529 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 24 Jun 2015 11:31:05 +0200 Subject: rm --- training/dtrain/sample_net.h | 61 -------------------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 training/dtrain/sample_net.h (limited to 'training/dtrain') diff --git a/training/dtrain/sample_net.h b/training/dtrain/sample_net.h deleted file mode 100644 index 497149d9..00000000 --- a/training/dtrain/sample_net.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef _DTRAIN_SAMPLE_NET_H_ -#define _DTRAIN_SAMPLE_NET_H_ - -#include "kbest.h" - -#include "score.h" - -namespace dtrain -{ - -struct ScoredKbest : public DecoderObserver -{ - const size_t k_; - size_t feature_count_, effective_sz_; - vector samples_; - PerSentenceBleuScorer* scorer_; - vector* ref_ngs_; - vector* ref_ls_; - bool dont_score; - - ScoredKbest(const size_t k, PerSentenceBleuScorer* scorer) : - k_(k), scorer_(scorer), dont_score(false) {} - - virtual void - NotifyTranslationForest(const SentenceMetadata& smeta, Hypergraph* hg) - { - samples_.clear(); effective_sz_ = feature_count_ = 0; - KBest::KBestDerivations, ESentenceTraversal, - KBest::FilterUnique, prob_t, EdgeProb> kbest(*hg, k_); - for (size_t i = 0; i < k_; ++i) { - const KBest::KBestDerivations, ESentenceTraversal, - KBest::FilterUnique, prob_t, EdgeProb>::Derivation* d = - kbest.LazyKthBest(hg->nodes_.size() - 1, i); - if (!d) break; - ScoredHyp h; - h.w = d->yield; - h.f = d->feature_values; - h.model = log(d->score); - h.rank = i; - if (!dont_score) - h.gold = scorer_->Score(h.w, *ref_ngs_, *ref_ls_); - samples_.push_back(h); - effective_sz_++; - feature_count_ += h.f.size(); - } - } - - vector* GetSamples() { return &samples_; } - inline void SetReference(vector& ngs, vector& ls) - { - ref_ngs_ = &ngs; - ref_ls_ = &ls; - } - inline size_t GetFeatureCount() { return feature_count_; } - inline size_t GetSize() { return effective_sz_; } -}; - -} // namespace - -#endif - -- cgit v1.2.3