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:
authorJake Hofman <jhofman@gmail.com>2014-01-07 02:01:15 +0400
committerJake Hofman <jhofman@gmail.com>2014-01-07 02:01:15 +0400
commitad6ac6854cb482bc4ab27f1cdc4a5276b7bf27b8 (patch)
tree2b8267ee7c7a125c64f51038eac027cc3628354c /vowpalwabbit/lrq.cc
parentef823fba0220b7693f21b17f71261db1bcccf431 (diff)
reductions now have predict functions, but tests break
Diffstat (limited to 'vowpalwabbit/lrq.cc')
-rw-r--r--vowpalwabbit/lrq.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/vowpalwabbit/lrq.cc b/vowpalwabbit/lrq.cc
index d38d3d7b..72c10554 100644
--- a/vowpalwabbit/lrq.cc
+++ b/vowpalwabbit/lrq.cc
@@ -61,7 +61,8 @@ namespace {
namespace LRQ {
- void learn(void* d, learner& base, example* ec)
+ template <bool is_learn>
+ void predict_or_learn(void* d, learner& base, example* ec)
{
LRQstate* lrq = (LRQstate*) d;
vw& all = *lrq->all;
@@ -145,7 +146,10 @@ namespace LRQ {
}
}
- base.learn(ec);//Recursive Call
+ if (is_learn)
+ base.learn(ec);
+ else
+ base.predict(ec);
// Restore example
@@ -243,7 +247,7 @@ namespace LRQ {
cerr<<endl;
all.wpp = all.wpp * (1 + maxk);
- learner* l = new learner(lrq, learn, all.l, 1 + maxk);
+ learner* l = new learner(lrq, predict_or_learn<true>, predict_or_learn<false>, all.l, 1 + maxk);
l->set_end_pass (reset_seed);
// TODO: leaks memory ?