summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--decoder/hg.h2
-rw-r--r--dtrain/dtrain.cc21
-rw-r--r--dtrain/kbestget.h8
-rw-r--r--klm/lm/binary_format.hh2
-rw-r--r--klm/lm/model_test.cc8
-rw-r--r--utils/dict.h5
-rw-r--r--utils/weights.cc1
7 files changed, 15 insertions, 32 deletions
diff --git a/decoder/hg.h b/decoder/hg.h
index 52a18601..f0ddbb76 100644
--- a/decoder/hg.h
+++ b/decoder/hg.h
@@ -397,8 +397,6 @@ public:
template <class V>
void Reweight(const V& weights) {
for (int i = 0; i < edges_.size(); ++i) {
- SparseVector<double> v;
- //v.set_value(FD::Convert("use_shell"), 1000);
Edge& e = edges_[i];
e.edge_prob_.logeq(e.feature_values_.dot(weights));
}
diff --git a/dtrain/dtrain.cc b/dtrain/dtrain.cc
index e96b65aa..795c82fd 100644
--- a/dtrain/dtrain.cc
+++ b/dtrain/dtrain.cc
@@ -188,15 +188,6 @@ main(int argc, char** argv)
}
- //LogVal<double> a(2.2);
- //LogVal<double> b(2.1);
- //cout << a << endl;
- //cout << log(a) << endl;
- //LogVal<double> c = a - b;
- //cout << log(c) << endl;
- //exit(0);
-
-
for (unsigned t = 0; t < T; t++) // T epochs
{
@@ -298,7 +289,7 @@ main(int argc, char** argv)
// FIXME
/*if (verbose) {
cout << "[ref: '";
- if (t > 0) cout << ref_ids_buf[ii];
+ if (t > 0) cout << ref_ids_buf[ii]; <---
else cout << ref_ids;
cout << endl;
cout << _p5 << _np << "1best: " << "'" << (*samples)[0].w << "'" << endl;
@@ -355,14 +346,16 @@ main(int argc, char** argv)
}
}
-
+ // DEBUG
vector<weight_t> x;
lambdas.init_vector(&x);
- for (int q = 0; q < x.size(); q++) {
- if (x[q] < -10 && x[q] != 0)
- cout << FD::Convert(q) << " " << x[q] << endl;
+ cout << "[" << ii << "]" << endl;
+ for (int jj = 0; jj < x.size(); jj++) {
+ if (x[jj] != 0)
+ cout << FD::Convert(jj) << " " << x[jj] << endl;
}
cout << " --- " << endl;
+ // /DEBUG
++ii;
diff --git a/dtrain/kbestget.h b/dtrain/kbestget.h
index 4aadee7a..98f289eb 100644
--- a/dtrain/kbestget.h
+++ b/dtrain/kbestget.h
@@ -107,8 +107,10 @@ struct KBestGetter : public HypSampler
ScoredHyp h;
h.w = d->yield;
h.f = d->feature_values;
- h.model = d->score;
- cout << i << ". "<< h.model << endl;
+ h.model = d->score.as_float();
+ // DEBUG
+ cout << i+1 << ". "<< h.model << endl;
+ // /DEBUG
h.rank = i;
h.score = scorer_->Score(h.w, *ref_, i);
s_.push_back(h);
@@ -127,7 +129,7 @@ struct KBestGetter : public HypSampler
ScoredHyp h;
h.w = d->yield;
h.f = d->feature_values;
- h.model = -1*log(d->score);
+ h.model = d->score.as_float();
h.rank = i;
h.score = scorer_->Score(h.w, *ref_, i);
s_.push_back(h);
diff --git a/klm/lm/binary_format.hh b/klm/lm/binary_format.hh
index a83f6b89..e9df0892 100644
--- a/klm/lm/binary_format.hh
+++ b/klm/lm/binary_format.hh
@@ -76,8 +76,6 @@ void MatchCheck(ModelType model_type, unsigned int search_version, const Paramet
void SeekPastHeader(int fd, const Parameters &params);
-void SeekPastHeader(int fd, const Parameters &params);
-
uint8_t *SetupBinary(const Config &config, const Parameters &params, std::size_t memory_size, Backing &backing);
void ComplainAboutARPA(const Config &config, ModelType model_type);
diff --git a/klm/lm/model_test.cc b/klm/lm/model_test.cc
index 3585d34b..2654071f 100644
--- a/klm/lm/model_test.cc
+++ b/klm/lm/model_test.cc
@@ -264,14 +264,6 @@ template <class M> void NoUnkCheck(const M &model) {
BOOST_CHECK_CLOSE(-100.0, ret.prob, 0.001);
}
-template <class M> void NoUnkCheck(const M &model) {
- WordIndex unk_index = 0;
- State state;
-
- FullScoreReturn ret = model.FullScoreForgotState(&unk_index, &unk_index + 1, unk_index, state);
- BOOST_CHECK_CLOSE(-100.0, ret.prob, 0.001);
-}
-
template <class M> void Everything(const M &m) {
Starters(m);
Continuation(m);
diff --git a/utils/dict.h b/utils/dict.h
index 33cca6cf..a3400868 100644
--- a/utils/dict.h
+++ b/utils/dict.h
@@ -1,7 +1,6 @@
#ifndef DICT_H_
#define DICT_H_
-#include <iostream>
#include <cassert>
#include <cstring>
@@ -73,8 +72,8 @@ class Dict {
inline const std::string& Convert(const WordID& id) const {
if (id == 0) return b0_;
- //assert(id <= (int)words_.size());
- if (id < 0 || id > (int)words_.size()) return b0_;
+ assert(id <= (int)words_.size());
+ //if (id < 0 || id > (int)words_.size()) return b0_;
return words_[id-1];
}
diff --git a/utils/weights.cc b/utils/weights.cc
index f1406cbf..ac407dfb 100644
--- a/utils/weights.cc
+++ b/utils/weights.cc
@@ -154,3 +154,4 @@ void Weights::ShowLargestFeatures(const vector<weight_t>& w) {
cerr << endl;
}
+