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:
authorJohn Langford <jl@hunch.net>2014-12-31 21:22:39 +0300
committerJohn Langford <jl@hunch.net>2014-12-31 21:22:39 +0300
commit3bf43f01cda63308e78b8a6cc7aeabd795e4a3c2 (patch)
treef598e364fc1794766648bb165f2032b2ef53d087
parentfc8034d53385a87d34cad922cfbb238a512fe664 (diff)
dealt with lingering dependencies
-rw-r--r--vowpalwabbit/active.cc6
-rw-r--r--vowpalwabbit/autolink.cc4
-rw-r--r--vowpalwabbit/binary.cc3
-rw-r--r--vowpalwabbit/bs.cc2
-rw-r--r--vowpalwabbit/cb_algs.cc9
-rw-r--r--vowpalwabbit/cbify.cc13
-rw-r--r--vowpalwabbit/csoaa.cc4
-rw-r--r--vowpalwabbit/ect.cc2
-rw-r--r--vowpalwabbit/log_multi.cc2
-rw-r--r--vowpalwabbit/lrq.cc2
-rw-r--r--vowpalwabbit/mf.cc2
-rw-r--r--vowpalwabbit/nn.cc2
-rw-r--r--vowpalwabbit/oaa.cc2
-rw-r--r--vowpalwabbit/parse_args.cc38
-rw-r--r--vowpalwabbit/scorer.cc7
-rw-r--r--vowpalwabbit/stagewise_poly.cc4
-rw-r--r--vowpalwabbit/topk.cc6
17 files changed, 42 insertions, 66 deletions
diff --git a/vowpalwabbit/active.cc b/vowpalwabbit/active.cc
index 23ccc2b1..72b000dc 100644
--- a/vowpalwabbit/active.cc
+++ b/vowpalwabbit/active.cc
@@ -169,15 +169,17 @@ namespace ACTIVE {
if (vm.count("mellowness"))
data.active_c0 = vm["mellowness"].as<float>();
+ base_learner* base = setup_base(all,vm);
+
//Create new learner
learner<active>* ret;
if (vm.count("simulation"))
- ret = &init_learner(&data, all.l, predict_or_learn_simulation<true>,
+ ret = &init_learner(&data, base, predict_or_learn_simulation<true>,
predict_or_learn_simulation<false>);
else
{
all.active = true;
- ret = &init_learner(&data, all.l, predict_or_learn_active<true>,
+ ret = &init_learner(&data, base, predict_or_learn_active<true>,
predict_or_learn_active<false>);
ret->set_finish_example(return_active_example);
}
diff --git a/vowpalwabbit/autolink.cc b/vowpalwabbit/autolink.cc
index ba25b262..44fc05ec 100644
--- a/vowpalwabbit/autolink.cc
+++ b/vowpalwabbit/autolink.cc
@@ -52,7 +52,9 @@ namespace ALINK {
*all.file_options << " --autolink " << data.d;
- LEARNER::learner<autolink>& ret = init_learner(&data, all.l, predict_or_learn<true>,
+ LEARNER::base_learner* base = setup_base(all,vm);
+
+ LEARNER::learner<autolink>& ret = init_learner(&data, base, predict_or_learn<true>,
predict_or_learn<false>);
return make_base(ret);
}
diff --git a/vowpalwabbit/binary.cc b/vowpalwabbit/binary.cc
index 9951ddd3..74d894b6 100644
--- a/vowpalwabbit/binary.cc
+++ b/vowpalwabbit/binary.cc
@@ -39,7 +39,8 @@ LEARNER::base_learner* setup(vw& all, po::variables_map& vm)
//Create new learner
LEARNER::learner<char>& ret =
- LEARNER::init_learner<char>(NULL, all.l, predict_or_learn<true>, predict_or_learn<false>);
+ LEARNER::init_learner<char>(NULL, setup_base(all,vm),
+ predict_or_learn<true>, predict_or_learn<false>);
return make_base(ret);
}
}
diff --git a/vowpalwabbit/bs.cc b/vowpalwabbit/bs.cc
index 78828632..1f538a7d 100644
--- a/vowpalwabbit/bs.cc
+++ b/vowpalwabbit/bs.cc
@@ -280,7 +280,7 @@ namespace BS {
data.pred_vec.reserve(data.B);
data.all = &all;
- learner<bs>& l = init_learner(&data, all.l, predict_or_learn<true>,
+ learner<bs>& l = init_learner(&data, setup_base(all,vm), predict_or_learn<true>,
predict_or_learn<false>, data.B);
l.set_finish_example(finish_example);
l.set_finish(finish);
diff --git a/vowpalwabbit/cb_algs.cc b/vowpalwabbit/cb_algs.cc
index 458e6b44..a9827f27 100644
--- a/vowpalwabbit/cb_algs.cc
+++ b/vowpalwabbit/cb_algs.cc
@@ -496,6 +496,11 @@ namespace CB_ALGS
*all.file_options << " --cb_type dr";
}
+ if (!vm.count("csoaa"))
+ vm.insert(pair<string,po::variable_value>(string("csoaa"),vm["cb"]));
+
+ base_learner* base = setup_base(all,vm);
+
if (eval)
all.p->lp = CB_EVAL::cb_eval;
else
@@ -504,12 +509,12 @@ namespace CB_ALGS
learner<cb>* l;
if (eval)
{
- l = &init_learner(&c, all.l, learn_eval, predict_eval, problem_multiplier);
+ l = &init_learner(&c, base, learn_eval, predict_eval, problem_multiplier);
l->set_finish_example(eval_finish_example);
}
else
{
- l = &init_learner(&c, all.l, predict_or_learn<true>, predict_or_learn<false>,
+ l = &init_learner(&c, base, predict_or_learn<true>, predict_or_learn<false>,
problem_multiplier);
l->set_finish_example(finish_example);
}
diff --git a/vowpalwabbit/cbify.cc b/vowpalwabbit/cbify.cc
index 9b2e3147..05eda7d3 100644
--- a/vowpalwabbit/cbify.cc
+++ b/vowpalwabbit/cbify.cc
@@ -390,7 +390,12 @@ namespace CBIFY {
data.k = (uint32_t)vm["cbify"].as<size_t>();
*all.file_options << " --cbify " << data.k;
+ if (!vm.count("cb"))
+ vm.insert(pair<string,po::variable_value>(string("cb"),vm["cbify"]));
+ base_learner* base = setup_base(all,vm);
+
all.p->lp = MULTICLASS::mc_label;
+
learner<cbify>* l;
data.recorder.reset(new vw_recorder());
data.mwt_explorer.reset(new MwtExplorer<vw_context>("vw", *data.recorder.get()));
@@ -405,7 +410,7 @@ namespace CBIFY {
epsilon = vm["epsilon"].as<float>();
data.scorer.reset(new vw_cover_scorer(epsilon, cover, (u32)data.k));
data.generic_explorer.reset(new GenericExplorer<vw_context>(*data.scorer.get(), (u32)data.k));
- l = &init_learner(&data, all.l, predict_or_learn_cover<true>,
+ l = &init_learner(&data, base, predict_or_learn_cover<true>,
predict_or_learn_cover<false>, cover + 1);
}
else if (vm.count("bag"))
@@ -416,7 +421,7 @@ namespace CBIFY {
data.policies.push_back(unique_ptr<IPolicy<vw_context>>(new vw_policy(i)));
}
data.bootstrap_explorer.reset(new BootstrapExplorer<vw_context>(data.policies, (u32)data.k));
- l = &init_learner(&data, all.l, predict_or_learn_bag<true>,
+ l = &init_learner(&data, base, predict_or_learn_bag<true>,
predict_or_learn_bag<false>, bags);
}
else if (vm.count("first") )
@@ -424,7 +429,7 @@ namespace CBIFY {
uint32_t tau = (uint32_t)vm["first"].as<size_t>();
data.policy.reset(new vw_policy());
data.tau_explorer.reset(new TauFirstExplorer<vw_context>(*data.policy.get(), (u32)tau, (u32)data.k));
- l = &init_learner(&data, all.l, predict_or_learn_first<true>,
+ l = &init_learner(&data, base, predict_or_learn_first<true>,
predict_or_learn_first<false>, 1);
}
else
@@ -434,7 +439,7 @@ namespace CBIFY {
epsilon = vm["epsilon"].as<float>();
data.policy.reset(new vw_policy());
data.greedy_explorer.reset(new EpsilonGreedyExplorer<vw_context>(*data.policy.get(), epsilon, (u32)data.k));
- l = &init_learner(&data, all.l, predict_or_learn_greedy<true>,
+ l = &init_learner(&data, base, predict_or_learn_greedy<true>,
predict_or_learn_greedy<false>, 1);
}
diff --git a/vowpalwabbit/csoaa.cc b/vowpalwabbit/csoaa.cc
index 0928735a..f8cd55f3 100644
--- a/vowpalwabbit/csoaa.cc
+++ b/vowpalwabbit/csoaa.cc
@@ -86,7 +86,7 @@ namespace CSOAA {
all.p->lp = cs_label;
all.sd->k = nb_actions;
- learner<csoaa>& l = init_learner(&c, all.l, predict_or_learn<true>,
+ learner<csoaa>& l = init_learner(&c, setup_base(all,vm), predict_or_learn<true>,
predict_or_learn<false>, nb_actions);
l.set_finish_example(finish_example);
return make_base(l);
@@ -714,7 +714,7 @@ namespace LabelDict {
ld.read_example_this_loop = 0;
ld.need_to_clear = false;
- learner<ldf>& l = init_learner(&ld, all.l, predict_or_learn<true>, predict_or_learn<false>);
+ learner<ldf>& l = init_learner(&ld, setup_base(all,vm), predict_or_learn<true>, predict_or_learn<false>);
if (ld.is_singleline)
l.set_finish_example(finish_singleline_example);
else
diff --git a/vowpalwabbit/ect.cc b/vowpalwabbit/ect.cc
index aba4cf46..a3a78ba5 100644
--- a/vowpalwabbit/ect.cc
+++ b/vowpalwabbit/ect.cc
@@ -389,7 +389,7 @@ namespace ECT
size_t wpp = create_circuit(all, data, data.k, data.errors+1);
data.all = &all;
- learner<ect>& l = init_learner(&data, all.l, learn, predict, wpp);
+ learner<ect>& l = init_learner(&data, setup_base(all,vm), learn, predict, wpp);
l.set_finish_example(finish_example);
l.set_finish(finish);
diff --git a/vowpalwabbit/log_multi.cc b/vowpalwabbit/log_multi.cc
index 1b5eb1a5..c91907a8 100644
--- a/vowpalwabbit/log_multi.cc
+++ b/vowpalwabbit/log_multi.cc
@@ -533,7 +533,7 @@ namespace LOG_MULTI
data.max_predictors = data.k - 1;
- learner<log_multi>& l = init_learner(&data, all.l, learn, predict, data.max_predictors);
+ learner<log_multi>& l = init_learner(&data, setup_base(all,vm), learn, predict, data.max_predictors);
l.set_save_load(save_load_tree);
l.set_finish_example(finish_example);
l.set_finish(finish);
diff --git a/vowpalwabbit/lrq.cc b/vowpalwabbit/lrq.cc
index 119a3a1f..99427ead 100644
--- a/vowpalwabbit/lrq.cc
+++ b/vowpalwabbit/lrq.cc
@@ -251,7 +251,7 @@ namespace LRQ {
cerr<<endl;
all.wpp = all.wpp * (1 + maxk);
- learner<LRQstate>& l = init_learner(&lrq, all.l, predict_or_learn<true>,
+ learner<LRQstate>& l = init_learner(&lrq, setup_base(all,vm), predict_or_learn<true>,
predict_or_learn<false>, 1 + maxk);
l.set_end_pass(reset_seed);
diff --git a/vowpalwabbit/mf.cc b/vowpalwabbit/mf.cc
index 4db6d280..4c1899f3 100644
--- a/vowpalwabbit/mf.cc
+++ b/vowpalwabbit/mf.cc
@@ -209,7 +209,7 @@ void finish(mf& o) {
all.random_positive_weights = true;
- learner<mf>& l = init_learner(&data, all.l, learn, predict<false>, 2*data.rank+1);
+ learner<mf>& l = init_learner(&data, setup_base(all,vm), learn, predict<false>, 2*data.rank+1);
l.set_finish(finish);
return make_base(l);
}
diff --git a/vowpalwabbit/nn.cc b/vowpalwabbit/nn.cc
index b59ca56b..a7079c95 100644
--- a/vowpalwabbit/nn.cc
+++ b/vowpalwabbit/nn.cc
@@ -366,7 +366,7 @@ CONVERSE: // That's right, I'm using goto. So sue me.
n.save_xsubi = n.xsubi;
n.increment = all.l->increment;//Indexing of output layer is odd.
- learner<nn>& l = init_learner(&n, all.l, predict_or_learn<true>,
+ learner<nn>& l = init_learner(&n, setup_base(all,vm), predict_or_learn<true>,
predict_or_learn<false>, n.k+1);
l.set_finish(finish);
l.set_finish_example(finish_example);
diff --git a/vowpalwabbit/oaa.cc b/vowpalwabbit/oaa.cc
index 03a7cac6..2cc78da3 100644
--- a/vowpalwabbit/oaa.cc
+++ b/vowpalwabbit/oaa.cc
@@ -79,7 +79,7 @@ namespace OAA {
*all.file_options << " --oaa " << data.k;
all.p->lp = MULTICLASS::mc_label;
- LEARNER::learner<oaa>& l = init_learner(&data, all.l, predict_or_learn<true>,
+ LEARNER::learner<oaa>& l = init_learner(&data, setup_base(all,vm), predict_or_learn<true>,
predict_or_learn<false>, data.k);
l.set_finish_example(finish_example);
return make_base(l);
diff --git a/vowpalwabbit/parse_args.cc b/vowpalwabbit/parse_args.cc
index 2ff0fd4b..04969290 100644
--- a/vowpalwabbit/parse_args.cc
+++ b/vowpalwabbit/parse_args.cc
@@ -784,38 +784,6 @@ void parse_reductions(vw& all, po::variables_map& vm)
all.l = setup_base(all,vm);
}
-void parse_cb(vw& all, po::variables_map& vm, bool& got_cs, bool& got_cb)
-{
- if( vm.count("cb"))
- {
- if(!got_cs) {
- if( vm.count("cb") ) vm.insert(pair<string,po::variable_value>(string("csoaa"),vm["cb"]));
- else vm.insert(pair<string,po::variable_value>(string("csoaa"),vm["cb"]));
-
- all.l = CSOAA::setup(all, vm); // default to CSOAA unless wap is specified
- got_cs = true;
- }
-
- got_cb = true;
- }
-
- if (vm.count("cbify"))
- {
- if(!got_cs) {
- vm.insert(pair<string,po::variable_value>(string("csoaa"),vm["cbify"]));
-
- all.l = CSOAA::setup(all, vm); // default to CSOAA unless wap is specified
- got_cs = true;
- }
-
- if (!got_cb) {
- vm.insert(pair<string,po::variable_value>(string("cb"),vm["cbify"]));
- all.l = CB_ALGS::setup(all, vm);
- got_cb = true;
- }
- }
-}
-
void add_to_args(vw& all, int argc, char* argv[])
{
for (int i = 1; i < argc; i++)
@@ -925,12 +893,6 @@ vw* parse_args(int argc, char *argv[])
parse_output_preds(*all, vm);
- bool got_cs = false;
-
- bool got_cb = false;
-
- parse_cb(*all, vm, got_cs, got_cb);
-
if(vm.count("bootstrap"))
all->l = BS::setup(*all, vm);
diff --git a/vowpalwabbit/scorer.cc b/vowpalwabbit/scorer.cc
index 76089bb8..c7e4519b 100644
--- a/vowpalwabbit/scorer.cc
+++ b/vowpalwabbit/scorer.cc
@@ -41,21 +41,22 @@ namespace Scorer {
scorer& s = calloc_or_die<scorer>();
s.all = &all;
+ LEARNER::base_learner* base = setup_base(all,vm);
LEARNER::learner<scorer>* l;
string link = vm["link"].as<string>();
if (!vm.count("link") || link.compare("identity") == 0)
- l = &init_learner(&s, all.l, predict_or_learn<true, id>, predict_or_learn<false, id>);
+ l = &init_learner(&s, base, predict_or_learn<true, id>, predict_or_learn<false, id>);
else if (link.compare("logistic") == 0)
{
*all.file_options << " --link=logistic ";
- l = &init_learner(&s, all.l, predict_or_learn<true, logistic>,
+ l = &init_learner(&s, base, predict_or_learn<true, logistic>,
predict_or_learn<false, logistic>);
}
else if (link.compare("glf1") == 0)
{
*all.file_options << " --link=glf1 ";
- l = &init_learner(&s, all.l, predict_or_learn<true, glf1>,
+ l = &init_learner(&s, base, predict_or_learn<true, glf1>,
predict_or_learn<false, glf1>);
}
else
diff --git a/vowpalwabbit/stagewise_poly.cc b/vowpalwabbit/stagewise_poly.cc
index c435f45b..b4546a00 100644
--- a/vowpalwabbit/stagewise_poly.cc
+++ b/vowpalwabbit/stagewise_poly.cc
@@ -7,7 +7,7 @@
#include "allreduce.h"
#include "accumulate.h"
#include "constant.h"
-#include "memory.h"
+#include "reductions.h"
#include "vw.h"
//#define MAGIC_ARGUMENT //MAY IT NEVER DIE
@@ -699,7 +699,7 @@ namespace StagewisePoly
//following is so that saved models know to load us.
*all.file_options << " --stage_poly";
- learner<stagewise_poly>& l = init_learner(&poly, all.l, learn, predict);
+ learner<stagewise_poly>& l = init_learner(&poly, setup_base(all,vm), learn, predict);
l.set_finish(finish);
l.set_save_load(save_load);
l.set_finish_example(finish_example);
diff --git a/vowpalwabbit/topk.cc b/vowpalwabbit/topk.cc
index d6ab27c5..e9d9fd2b 100644
--- a/vowpalwabbit/topk.cc
+++ b/vowpalwabbit/topk.cc
@@ -16,9 +16,7 @@ namespace TOPK {
struct compare_scored_examples
{
bool operator()(scored_example const& a, scored_example const& b) const
- {
- return a.first > b.first;
- }
+ { return a.first > b.first; }
};
struct topk{
@@ -115,7 +113,7 @@ namespace TOPK {
data.B = (uint32_t)vm["top"].as<size_t>();
data.all = &all;
- LEARNER::learner<topk>& l = init_learner(&data, all.l, predict_or_learn<true>,
+ LEARNER::learner<topk>& l = init_learner(&data, setup_base(all,vm), predict_or_learn<true>,
predict_or_learn<false>);
l.set_finish_example(finish_example);