Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
alekh committed Mar 16, 2016
1 parent 632448a commit 808f88c
Show file tree
Hide file tree
Showing 9 changed files with 401 additions and 374 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,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) -D_FILE_OFFSET_BITS=64 $(BOOST_INCLUDE) -g -O0 -fPIC
FLAGS = -std=c++0x $(CFLAGS) $(LDFLAGS) $(ARCH) $(WARN_FLAGS) -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 = -std=c++0x $(CFLAGS) $(LDFLAGS) -Wall $(ARCH) -ffast-math -D_FILE_OFFSET_BITS=64 $(BOOST_INCLUDE) -g -fomit-frame-pointer -ffast-math -fno-strict-aliasing -fPIC
Expand Down
4 changes: 3 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ nobase_include_HEADERS = vowpalwabbit/allreduce.h \
vowpalwabbit/vw_validate.h \
vowpalwabbit/multilabel.h \
vowpalwabbit/constant.h \
vowpalwabbit/ezexample.h
vowpalwabbit/ezexample.h \


noinst_HEADERS = vowpalwabbit/accumulate.h \
Expand All @@ -37,13 +37,15 @@ noinst_HEADERS = vowpalwabbit/accumulate.h \
vowpalwabbit/cache.h \
vowpalwabbit/cb.h \
vowpalwabbit/cb_algs.h \
vowpalwabbit/cb_explore.h \
vowpalwabbit/cbify.h \
vowpalwabbit/comp_io.h \
vowpalwabbit/constant.h \
vowpalwabbit/cost_sensitive.h \
vowpalwabbit/csoaa.h \
vowpalwabbit/ect.h \
vowpalwabbit/interactions.h \
vowpalwabbit/gen_cs_example.h \
vowpalwabbit/gd.h \
vowpalwabbit/gd_mf.h \
vowpalwabbit/interact.h \
Expand Down
2 changes: 1 addition & 1 deletion vowpalwabbit/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ liballreduce_la_SOURCES = allreduce_sockets.cc allreduce_threads.cc vw_exception

bin_PROGRAMS = vw active_interactor

libvw_la_SOURCES = hash.cc global_data.cc io_buf.cc parse_regressor.cc parse_primitives.cc unique_sort.cc cache.cc rand48.cc simple_label.cc multiclass.cc oaa.cc multilabel_oaa.cc boosting.cc ect.cc autolink.cc binary.cc lrq.cc cost_sensitive.cc multilabel.cc label_dictionary.cc csoaa.cc cb.cc cb_adf.cc cb_algs.cc mwt.cc search.cc search_meta.cc search_sequencetask.cc search_dep_parser.cc search_hooktask.cc search_multiclasstask.cc search_entityrelationtask.cc search_graph.cc parse_example.cc scorer.cc network.cc parse_args.cc accumulate.cc gd.cc learner.cc lda_core.cc gd_mf.cc mf.cc bfgs.cc noop.cc print.cc example.cc parser.cc loss_functions.cc sender.cc nn.cc confidence.cc bs.cc cbify.cc topk.cc stagewise_poly.cc log_multi.cc active.cc active_cover.cc kernel_svm.cc best_constant.cc ftrl.cc svrg.cc lrqfa.cc interact.cc comp_io.cc interactions.cc vw_exception.cc vw_validate.cc audit_regressor.cc
libvw_la_SOURCES = hash.cc global_data.cc io_buf.cc parse_regressor.cc parse_primitives.cc unique_sort.cc cache.cc rand48.cc simple_label.cc multiclass.cc oaa.cc multilabel_oaa.cc boosting.cc ect.cc autolink.cc binary.cc lrq.cc cost_sensitive.cc multilabel.cc label_dictionary.cc csoaa.cc cb.cc cb_adf.cc cb_algs.cc mwt.cc search.cc search_meta.cc search_sequencetask.cc search_dep_parser.cc search_hooktask.cc search_multiclasstask.cc search_entityrelationtask.cc search_graph.cc parse_example.cc scorer.cc network.cc parse_args.cc accumulate.cc gd.cc learner.cc lda_core.cc gd_mf.cc mf.cc bfgs.cc noop.cc print.cc example.cc parser.cc loss_functions.cc sender.cc nn.cc confidence.cc bs.cc cbify.cc topk.cc stagewise_poly.cc log_multi.cc active.cc active_cover.cc kernel_svm.cc best_constant.cc ftrl.cc svrg.cc lrqfa.cc interact.cc comp_io.cc interactions.cc vw_exception.cc vw_validate.cc audit_regressor.cc gen_cs_example.cc cb_explore.cc

libvw_c_wrapper_la_SOURCES = vwdll.cpp

Expand Down
14 changes: 7 additions & 7 deletions vowpalwabbit/cb_algs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ using namespace CB;

struct cb
{
cb_to_cs& cbcs;
cb_to_cs* cbcs;
COST_SENSITIVE::label cb_cs_ld;
};

Expand Down Expand Up @@ -48,7 +48,7 @@ template <bool is_learn>
void predict_or_learn(cb& data, base_learner& base, example& ec)
{ CB::label ld = ec.l.cb;

cb_to_cs& c = data.cbcs;
cb_to_cs& c = *data.cbcs;
c.known_cost = get_observed_cost(ld);
if (c.known_cost != nullptr && (c.known_cost->action < 1 || c.known_cost->action > c.num_actions))
cerr << "invalid action: " << c.known_cost->action << endl;
Expand Down Expand Up @@ -76,7 +76,7 @@ void predict_eval(cb&, base_learner&, example&)
void learn_eval(cb& data, base_learner&, example& ec)
{ CB_EVAL::label ld = ec.l.cb_eval;

cb_to_cs& c = data.cbcs;
cb_to_cs& c = *data.cbcs;
c.known_cost = get_observed_cost(ld.event);
gen_cs_example<true>(c, ec, ld.event, data.cb_cs_ld);

Expand All @@ -97,7 +97,7 @@ float get_unbiased_cost(CB::cb_class* observation, COST_SENSITIVE::label& scores
void output_example(vw& all, cb& data, example& ec, CB::label& ld)
{ float loss = 0.;

cb_to_cs& c = data.cbcs;
cb_to_cs& c = *data.cbcs;
if(!is_test_label(ld))
loss = get_unbiased_cost(c.known_cost, c.pred_scores, ec.pred.multiclass);

Expand All @@ -121,7 +121,7 @@ void output_example(vw& all, cb& data, example& ec, CB::label& ld)

void finish(cb& data)
{
cb_to_cs& c = data.cbcs;
cb_to_cs& c = *data.cbcs;
data.cb_cs_ld.costs.delete_v();
COST_SENSITIVE::cs_label.delete_label(&c.pred_scores);
free(&c);
Expand All @@ -146,8 +146,8 @@ base_learner* cb_algs_setup(vw& all)
add_options(all);

cb& data = calloc_or_throw<cb>();
data.cbcs = calloc_or_throw<cb_to_cs>();
cb_to_cs& c = data.cbcs;
data.cbcs = &calloc_or_throw<cb_to_cs>();
cb_to_cs& c = *data.cbcs;
c.num_actions = (uint32_t)all.vm["cb"].as<size_t>();

bool eval = false;
Expand Down
Loading

0 comments on commit 808f88c

Please sign in to comment.