From a31b9b2bfdb232cc8fb2e4f05326c01c0cd2323d Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Wed, 16 Nov 2011 10:51:47 +0100
Subject: hadoop doesn't like double as amounts in counters
---
dtrain/dtrain.cc | 16 ++++++++--------
dtrain/dtrain.h | 7 +------
dtrain/test/example/dtrain.ini | 6 +++---
3 files changed, 12 insertions(+), 17 deletions(-)
(limited to 'dtrain')
diff --git a/dtrain/dtrain.cc b/dtrain/dtrain.cc
index d69e62e5..7cc6af6f 100644
--- a/dtrain/dtrain.cc
+++ b/dtrain/dtrain.cc
@@ -456,8 +456,8 @@ main(int argc, char** argv)
if (t == 0) {
in_sz = ii; // remember size of input (# lines)
if (hstreaming) {
- rep.update_counter("|Input|", ii+1);
- rep.update_gcounter("|Input|", ii+1);
+ rep.update_counter("|Input|", ii);
+ rep.update_gcounter("|Input|", ii);
rep.update_gcounter("Shards", 1u);
}
}
@@ -482,7 +482,7 @@ main(int argc, char** argv)
model_diff = model_avg;
}
- if (!quiet) {
+ if (true) {
cerr << _p5 << _p << "WEIGHTS" << endl;
for (vector::iterator it = print_weights.begin(); it != print_weights.end(); it++) {
cerr << setw(18) << *it << " = " << lambdas.get(FD::Convert(*it)) << endl;
@@ -501,11 +501,11 @@ main(int argc, char** argv)
}
if (hstreaming) {
- rep.update_counter("Score 1best avg #"+boost::lexical_cast(t+1), score_avg);
- rep.update_counter("Model 1best avg #"+boost::lexical_cast(t+1), model_avg);
- rep.update_counter("Pairs avg #"+boost::lexical_cast(t+1), npairs/(weight_t)in_sz);
- rep.update_counter("Rank errors avg #"+boost::lexical_cast(t+1), rank_errors/(weight_t)in_sz);
- rep.update_counter("Margin violations avg #"+boost::lexical_cast(t+1), margin_violations/(weight_t)in_sz);
+ rep.update_counter("Score 1best avg #"+boost::lexical_cast(t+1), (unsigned)(score_avg*100000));
+ rep.update_counter("Model 1best avg #"+boost::lexical_cast(t+1), (unsigned)(model_avg*100000));
+ rep.update_counter("Pairs avg #"+boost::lexical_cast(t+1), (unsigned)((npairs/(weight_t)in_sz)*100000));
+ rep.update_counter("Rank errors avg #"+boost::lexical_cast(t+1), (unsigned)((rank_errors/(weight_t)in_sz)*100000));
+ rep.update_counter("Margin violations avg #"+boost::lexical_cast(t+1), (unsigned)((margin_violations/(weight_t)in_sz)*100000));
unsigned nonz = (unsigned)lambdas.size_nonzero();
rep.update_counter("Non zero feature count #"+boost::lexical_cast(t+1), nonz);
rep.update_gcounter("Non zero feature count #"+boost::lexical_cast(t+1), nonz);
diff --git a/dtrain/dtrain.h b/dtrain/dtrain.h
index cfc3f460..1b33c081 100644
--- a/dtrain/dtrain.h
+++ b/dtrain/dtrain.h
@@ -57,15 +57,10 @@ struct HSReporter
string task_id_;
HSReporter(string task_id) : task_id_(task_id) {}
- inline void update_counter(string name, weight_t amount) {
- cerr << "reporter:counter:" << task_id_ << "," << name << "," << amount << endl;
- }
+
inline void update_counter(string name, unsigned amount) {
cerr << "reporter:counter:" << task_id_ << "," << name << "," << amount << endl;
}
- inline void update_gcounter(string name, weight_t amount) {
- cerr << "reporter:counter:Global," << name << "," << amount << endl;
- }
inline void update_gcounter(string name, unsigned amount) {
cerr << "reporter:counter:Global," << name << "," << amount << endl;
}
diff --git a/dtrain/test/example/dtrain.ini b/dtrain/test/example/dtrain.ini
index 900878a5..0b066013 100644
--- a/dtrain/test/example/dtrain.ini
+++ b/dtrain/test/example/dtrain.ini
@@ -4,9 +4,9 @@ N=3
gamma=0.001
epochs=20
input=test/example/nc-1k-tabs.gz
-scorer=stupid_bleu
-output=weights.gz
-stop_after=100
+scorer=smooth_bleu
+output=- #weights.gz
+stop_after=5
sample_from=forest
pair_sampling=108010
select_weights=VOID
--
cgit v1.2.3