diff options
author | Jacob Hofman <hofman@research-mm10.corp.sp1.yahoo.com> | 2010-09-22 23:57:57 +0400 |
---|---|---|
committer | Jacob Hofman <hofman@research-mm10.corp.sp1.yahoo.com> | 2010-09-22 23:57:57 +0400 |
commit | 514311c9f089b20c2cf6ac22e823058fd23138ba (patch) | |
tree | c5d147f1ccd8eb7dfe96fea0916e3d69653a6200 /parser.cc | |
parent | dc0ad64407c464dc00046a1c83b36fda086ff391 (diff) |
commit before modifying for differential predictions. currently loss eventually blows up
Diffstat (limited to 'parser.cc')
-rw-r--r-- | parser.cc | 31 |
1 files changed, 24 insertions, 7 deletions
@@ -540,13 +540,30 @@ void setup_example(parser* p, example* ae) } ae->total_sum_feat_sq += ae->sum_feat_sq[*i]; } - for (vector<string>::iterator i = global.pairs.begin(); i != global.pairs.end();i++) - { - ae->num_features - += (ae->atomics[(int)(*i)[0]].end - ae->atomics[(int)(*i)[0]].begin) - *(ae->atomics[(int)(*i)[1]].end - ae->atomics[(int)(*i)[1]].begin); - ae->total_sum_feat_sq += ae->sum_feat_sq[(int)(*i)[0]]*ae->sum_feat_sq[(int)(*i)[1]]; - } + + + if (global.rank == 0) + for (vector<string>::iterator i = global.pairs.begin(); i != global.pairs.end();i++) + { + ae->num_features + += (ae->atomics[(int)(*i)[0]].end - ae->atomics[(int)(*i)[0]].begin) + *(ae->atomics[(int)(*i)[1]].end - ae->atomics[(int)(*i)[1]].begin); + + ae->total_sum_feat_sq += ae->sum_feat_sq[(int)(*i)[0]]*ae->sum_feat_sq[(int)(*i)[1]]; + + } + else + for (vector<string>::iterator i = global.pairs.begin(); i != global.pairs.end();i++) + { + ae->num_features + += (ae->atomics[(int)(*i)[0]].end - ae->atomics[(int)(*i)[0]].begin) + *global.rank; + ae->num_features + += (ae->atomics[(int)(*i)[1]].end - ae->atomics[(int)(*i)[1]].begin) + *global.rank; + } + + } void *main_parse_loop(void *in) |