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:
Diffstat (limited to 'vowpalwabbit/scorer.cc')
-rw-r--r--vowpalwabbit/scorer.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/vowpalwabbit/scorer.cc b/vowpalwabbit/scorer.cc
index a889a2ed..51be45f2 100644
--- a/vowpalwabbit/scorer.cc
+++ b/vowpalwabbit/scorer.cc
@@ -10,7 +10,7 @@ namespace Scorer {
};
template <bool is_learn, float (*link)(float in)>
- void predict_or_learn(scorer& s, learner& base, example& ec)
+ void predict_or_learn(scorer& s, base_learner& base, example& ec)
{
s.all->set_minmax(s.all->sd, ec.l.simple.label);
@@ -45,7 +45,7 @@ namespace Scorer {
return in;
}
- learner* setup(vw& all, po::variables_map& vm)
+ base_learner* setup(vw& all, po::variables_map& vm)
{
po::options_description opts("Link options");
opts.add_options()
@@ -56,23 +56,23 @@ namespace Scorer {
scorer& s = calloc_or_die<scorer>();
s.all = &all;
- learner* l = new learner(&s, all.l);
+ learner<scorer>& l = init_learner(&s, all.l);
if (!vm.count("link") || link.compare("identity") == 0)
{
- l->set_learn<scorer, predict_or_learn<true, noop> >();
- l->set_predict<scorer, predict_or_learn<false, noop> >();
+ l.set_learn(predict_or_learn<true, noop> );
+ l.set_predict(predict_or_learn<false, noop> );
}
else if (link.compare("logistic") == 0)
{
- all.file_options << " --link=logistic ";
- l->set_learn<scorer, predict_or_learn<true, logistic> >();
- l->set_predict<scorer, predict_or_learn<false, logistic> >();
+ *all.file_options << " --link=logistic ";
+ l.set_learn(predict_or_learn<true, logistic> );
+ l.set_predict(predict_or_learn<false, logistic>);
}
else if (link.compare("glf1") == 0)
{
- all.file_options << " --link=glf1 ";
- l->set_learn<scorer, predict_or_learn<true, glf1> >();
- l->set_predict<scorer, predict_or_learn<false, glf1> >();
+ *all.file_options << " --link=glf1 ";
+ l.set_learn(predict_or_learn<true, glf1>);
+ l.set_predict(predict_or_learn<false, glf1>);
}
else
{
@@ -80,6 +80,6 @@ namespace Scorer {
throw exception();
}
- return l;
+ return make_base(l);
}
}