diff options
author | Hal Daume III <me@hal3.name> | 2014-07-23 23:48:57 +0400 |
---|---|---|
committer | Hal Daume III <me@hal3.name> | 2014-07-23 23:48:57 +0400 |
commit | d39a775a09b558e1da6993bdb780f01811f3ea99 (patch) | |
tree | b4d4e10273485c8aee0d4a9ca286a00d8856e64b | |
parent | 40fa999f270885d2e052f40ad7d17f14188eb85a (diff) |
fixed holdout bug
-rw-r--r-- | vowpalwabbit/parser.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/vowpalwabbit/parser.cc b/vowpalwabbit/parser.cc index 5a58ef09..26a65432 100644 --- a/vowpalwabbit/parser.cc +++ b/vowpalwabbit/parser.cc @@ -140,11 +140,11 @@ void handle_sigterm (int) got_sigterm = true; } -bool is_test_only(uint32_t counter, uint32_t period, uint32_t after, bool holdout_off) +bool is_test_only(uint32_t counter, uint32_t period, uint32_t after, bool holdout_off, uint32_t target_modulus) // target should be 0 in the normal case, or period-1 in the case that emptylines separate examples { if(holdout_off) return false; if (after == 0) // hold out by period - return (counter % period == 0); + return (counter % period == target_modulus); else // hold out by position return (counter+1 >= after); } @@ -757,10 +757,11 @@ void setup_example(vw& all, example* ae) if ((!all.p->emptylines_separate_examples) || example_is_newline(*ae)) all.p->in_pass_counter++; - ae->test_only = is_test_only(all.p->in_pass_counter, all.holdout_period, all.holdout_after, all.holdout_set_off); + ae->test_only = is_test_only(all.p->in_pass_counter, all.holdout_period, all.holdout_after, all.holdout_set_off, all.p->emptylines_separate_examples ? (all.holdout_period-1) : 0); all.sd->t += all.p->lp.get_weight(ae->ld); ae->example_t = (float)all.sd->t; + if (all.ignore_some) { if (all.audit || all.hash_inv) |