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 22:03:11 +0300
committerJohn Langford <jl@hunch.net>2014-12-31 22:03:11 +0300
commit0ebdba756608594dd03ccf8b3d3166b34faa2a9b (patch)
tree7e33ae3025dffa2155391dd45dab4e2935edf5e8
parent3bf43f01cda63308e78b8a6cc7aeabd795e4a3c2 (diff)
now working through test suite
-rw-r--r--Makefile2
-rw-r--r--vowpalwabbit/bs.cc17
-rw-r--r--vowpalwabbit/global_data.cc1
-rw-r--r--vowpalwabbit/global_data.h2
-rw-r--r--vowpalwabbit/parse_args.cc15
-rw-r--r--vowpalwabbit/stagewise_poly.cc5
6 files changed, 21 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index 0d53bb54..910adad0 100644
--- a/Makefile
+++ b/Makefile
@@ -65,7 +65,7 @@ FLAGS = -std=c++0x $(CFLAGS) $(LDFLAGS) $(ARCH) $(WARN_FLAGS) $(OPTIM_FLAGS) -D_
#CXX = g++
# for valgrind / gdb debugging
-#FLAGS = -std=c++0x $(CFLAGS) $(LDFLAGS) $(ARCH) $(WARN_FLAGS) -ffast-math -D_FILE_OFFSET_BITS=64 $(BOOST_INCLUDE) -g -O0 -fPIC
+FLAGS = -std=c++0x $(CFLAGS) $(LDFLAGS) $(ARCH) $(WARN_FLAGS) -ffast-math -D_FILE_OFFSET_BITS=64 $(BOOST_INCLUDE) -g -O0 -fPIC
# for valgrind profiling: run 'valgrind --tool=callgrind PROGRAM' then 'callgrind_annotate --tree=both --inclusive=yes'
#FLAGS = $(CFLAGS) $(LDFLAGS) -Wall $(ARCH) -ffast-math -D_FILE_OFFSET_BITS=64 $(BOOST_INCLUDE) -g -O2 -fomit-frame-pointer -ffast-math -fno-strict-aliasing -fPIC
diff --git a/vowpalwabbit/bs.cc b/vowpalwabbit/bs.cc
index 1f538a7d..cff38145 100644
--- a/vowpalwabbit/bs.cc
+++ b/vowpalwabbit/bs.cc
@@ -241,16 +241,19 @@ namespace BS {
base_learner* setup(vw& all, po::variables_map& vm)
{
- bs& data = calloc_or_die<bs>();
- data.ub = FLT_MAX;
- data.lb = -FLT_MAX;
-
- po::options_description bs_options("Bootstrap options");
- bs_options.add_options()
+ po::options_description opts("Bootstrap options");
+ opts.add_options()
+ ("bootstrap,B", po::value<size_t>(), "bootstrap mode with k rounds by online importance resampling")
("bs_type", po::value<string>(), "prediction type {mean,vote}");
- vm = add_options(all, bs_options);
+ vm = add_options(all, opts);
+ if (!vm.count("bootstrap"))
+ return NULL;
+
+ bs& data = calloc_or_die<bs>();
+ data.ub = FLT_MAX;
+ data.lb = -FLT_MAX;
data.B = (uint32_t)vm["bootstrap"].as<size_t>();
//append bs with number of samples to options_from_file so it is saved to regressor later
diff --git a/vowpalwabbit/global_data.cc b/vowpalwabbit/global_data.cc
index b4e68aff..bc869477 100644
--- a/vowpalwabbit/global_data.cc
+++ b/vowpalwabbit/global_data.cc
@@ -247,6 +247,7 @@ vw::vw()
reg_mode = 0;
current_pass = 0;
+ reduction_stack=v_init<LEARNER::base_learner* (*)(vw&, po::variables_map&)>();
data_filename = "";
diff --git a/vowpalwabbit/global_data.h b/vowpalwabbit/global_data.h
index 664b4f51..6937c181 100644
--- a/vowpalwabbit/global_data.h
+++ b/vowpalwabbit/global_data.h
@@ -265,7 +265,7 @@ struct vw {
size_t length () { return ((size_t)1) << num_bits; };
uint32_t rank;
- v_array<LEARNER::base_learner* (*)(vw& all, po::variables_map& vm)> reduction_stack;
+ v_array<LEARNER::base_learner* (*)(vw&, po::variables_map&)> reduction_stack;
//Prediction output
v_array<int> final_prediction_sink; // set to send global predictions to.
diff --git a/vowpalwabbit/parse_args.cc b/vowpalwabbit/parse_args.cc
index 04969290..0781830c 100644
--- a/vowpalwabbit/parse_args.cc
+++ b/vowpalwabbit/parse_args.cc
@@ -780,6 +780,7 @@ void parse_reductions(vw& all, po::variables_map& vm)
all.reduction_stack.push_back(CB_ALGS::setup);
all.reduction_stack.push_back(CBIFY::setup);
all.reduction_stack.push_back(Search::setup);
+ all.reduction_stack.push_back(BS::setup);
all.l = setup_base(all,vm);
}
@@ -833,15 +834,9 @@ vw* parse_args(int argc, char *argv[])
("node", po::value<size_t>(&(all->node)),"node number in cluster parallel job")
;
- po::options_description other_opt("Other options");
- other_opt.add_options()
- ("bootstrap,B", po::value<size_t>(), "bootstrap mode with k rounds by online importance resampling")
- ;
-
desc.add(update_opt)
.add(weight_opt)
- .add(cluster_opt)
- .add(other_opt);
+ .add(cluster_opt);
po::variables_map vm = add_options(*all, desc);
@@ -879,6 +874,8 @@ vw* parse_args(int argc, char *argv[])
parse_output_model(*all, vm);
+ parse_reductions(*all, vm);
+
if (!all->quiet)
{
cerr << "Num weight bits = " << all->num_bits << endl;
@@ -893,9 +890,6 @@ vw* parse_args(int argc, char *argv[])
parse_output_preds(*all, vm);
- if(vm.count("bootstrap"))
- all->l = BS::setup(*all, vm);
-
load_input_model(*all, vm, io_temp);
parse_source(*all, vm);
@@ -1006,6 +1000,7 @@ namespace VW {
all.p->parse_name.delete_v();
free(all.p);
free(all.sd);
+ all.reduction_stack.delete_v();
delete all.file_options;
for (size_t i = 0; i < all.final_prediction_sink.size(); i++)
if (all.final_prediction_sink[i] != 1)
diff --git a/vowpalwabbit/stagewise_poly.cc b/vowpalwabbit/stagewise_poly.cc
index b4546a00..a40b765c 100644
--- a/vowpalwabbit/stagewise_poly.cc
+++ b/vowpalwabbit/stagewise_poly.cc
@@ -669,9 +669,10 @@ namespace StagewisePoly
#endif //MAGIC_ARGUMENT
;
vm = add_options(all, opts);
- if (vm.count("stage_poly"))
+
+ if (!vm.count("stage_poly"))
return NULL;
-
+
stagewise_poly& poly = calloc_or_die<stagewise_poly>();
poly.all = &all;
depthsbits_create(poly);