Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/vowpal_wabbit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVaclav Petricek <vpetricek@gmail.com>2014-04-02 03:38:56 +0400
committerVaclav Petricek <vpetricek@gmail.com>2014-04-02 03:38:56 +0400
commited465b15a6019f7ba8f895d69b806b6d1e9aeaae (patch)
tree3aefbdeb9951a59adbf1d9feefa4bd2943d6ba77 /vowpalwabbit/learner.cc
parent0284fdda584873878ec968d195378d041675b7fe (diff)
move early terminate check to end of pass
Diffstat (limited to 'vowpalwabbit/learner.cc')
-rw-r--r--vowpalwabbit/learner.cc23
1 files changed, 9 insertions, 14 deletions
diff --git a/vowpalwabbit/learner.cc b/vowpalwabbit/learner.cc
index 671f4de2..3f7c9e1b 100644
--- a/vowpalwabbit/learner.cc
+++ b/vowpalwabbit/learner.cc
@@ -15,7 +15,7 @@ namespace LEARNER
{
if ((ec = VW::get_example(all->p)) != NULL)//semiblocking operation.
{
- if (ec->indices.size() > 1) // one nonconstant feature.
+ if (ec->indices.size() > 1) // 1+ nonconstant feature. (most common case first)
{
all->l->learn(*ec);
all->l->finish_example(*all, *ec);
@@ -24,9 +24,14 @@ namespace LEARNER
{
all->l->end_pass();
VW::finish_example(*all,ec);
+ if(all->early_terminate)
+ {
+ all->p->done = true;
+ return;
+ }
}
else if (ec->tag.size() >= 4 && !strncmp((const char*) ec->tag.begin, "save", 4))
- {//save state
+ {// save state command
string final_regressor_name = all->final_regressor_name;
@@ -39,20 +44,10 @@ namespace LEARNER
VW::finish_example(*all,ec);
}
- else
+ else // empty example
{
all->l->learn(*ec);
-
- if(all->early_terminate)
- {
- all->p->done = true;
- all->l->finish_example(*all, *ec);
- return;
- }
- else
- {
- all->l->finish_example(*all, *ec);
- }
+ all->l->finish_example(*all, *ec);
}
}
else if (parser_done(all->p))