Vowpal Wabbit
|
#include "reductions.h"
#include "cb_algs.h"
#include "vw.h"
#include "hash.h"
#include "explore.h"
#include <vector>
Go to the source code of this file.
Classes | |
struct | cbify_adf_data |
struct | cbify |
Functions | |
float | loss (cbify &data, uint32_t label, uint32_t final_prediction) |
float | loss_cs (cbify &data, v_array< COST_SENSITIVE::wclass > &costs, uint32_t final_prediction) |
float | loss_csldf (cbify &data, std::vector< v_array< COST_SENSITIVE::wclass >> &cs_costs, uint32_t final_prediction) |
void | copy_example_to_adf (cbify &data, example &ec) |
template<bool is_learn, bool use_cs> | |
void | predict_or_learn (cbify &data, single_learner &base, example &ec) |
template<bool is_learn, bool use_cs> | |
void | predict_or_learn_adf (cbify &data, multi_learner &base, example &ec) |
void | init_adf_data (cbify &data, const size_t num_actions) |
template<bool is_learn> | |
void | do_actual_learning_ldf (cbify &data, multi_learner &base, multi_ex &ec_seq) |
void | output_example (vw &all, example &ec, bool &hit_loss, multi_ex *ec_seq) |
void | output_example_seq (vw &all, multi_ex &ec_seq) |
void | finish_multiline_example (vw &all, cbify &, multi_ex &ec_seq) |
base_learner * | cbify_setup (options_i &options, vw &all) |
base_learner * | cbifyldf_setup (options_i &options, vw &all) |
base_learner* cbify_setup | ( | options_i & | options, |
vw & | all | ||
) |
Definition at line 383 of file cbify.cc.
References VW::config::option_group_definition::add(), add(), VW::config::options_i::add_and_parse(), LEARNER::as_multiline(), LEARNER::as_singleline(), vw::delete_prediction, f, init_adf_data(), LEARNER::init_cost_sensitive_learner(), LEARNER::init_multiclass_learner(), VW::config::options_i::insert(), LEARNER::make_base(), VW::config::make_option(), vw::p, setup_base(), prediction_type::to_string(), uniform_hash(), and VW::config::options_i::was_supplied().
Referenced by parse_reductions().
base_learner* cbifyldf_setup | ( | options_i & | options, |
vw & | all | ||
) |
Definition at line 456 of file cbify.cc.
References VW::config::option_group_definition::add(), add(), VW::config::options_i::add_and_parse(), LEARNER::as_multiline(), COST_SENSITIVE::cs_label, vw::delete_prediction, f, finish_multiline_example(), LEARNER::init_learner(), VW::config::options_i::insert(), parser::lp, LEARNER::make_base(), VW::config::make_option(), prediction_type::multiclass, vw::p, LEARNER::learner< T, E >::set_finish_example(), setup_base(), prediction_type::to_string(), uniform_hash(), and VW::config::options_i::was_supplied().
Referenced by parse_reductions().
Definition at line 96 of file cbify.cc.
References a, cbify::adf_data, cbify::all, CB::cb_label, VW::copy_example_data(), label_parser::default_label, CB_ALGS::example_is_newline_not_header(), parameters::mask(), parameters::stride_shift(), label_parser::test_label, and vw::weights.
Referenced by predict_or_learn_adf().
void do_actual_learning_ldf | ( | cbify & | data, |
multi_learner & | base, | ||
multi_ex & | ec_seq | ||
) |
Definition at line 242 of file cbify.cc.
References CB::cb_class::action, cbify::app_seed, ACTION_SCORE::begin_scores(), cbify::cb_as, cbify::cb_costs, cbify::cb_label, CB::cb_class::cost, CB::label::costs, cbify::cs_costs, ACTION_SCORE::end_scores(), cbify::example_counter, LEARNER::learner< T, E >::learn(), loss_csldf(), LEARNER::learner< T, E >::predict(), CB::cb_class::probability, exploration::sample_after_normalizing(), and THROW.
Definition at line 373 of file cbify.cc.
References VW::finish_example(), and output_example_seq().
Referenced by cbifyldf_setup(), CCB::ccb_explore_adf_setup(), CSOAA::csldf_setup(), explore_eval_setup(), VW::cb_explore_adf::softmax::setup(), VW::cb_explore_adf::greedy::setup(), VW::cb_explore_adf::first::setup(), VW::cb_explore_adf::bag::setup(), VW::cb_explore_adf::cover::setup(), VW::cb_explore_adf::regcb::setup(), and Search::setup().
void init_adf_data | ( | cbify & | data, |
const size_t | num_actions | ||
) |
Definition at line 226 of file cbify.cc.
References a, cbify::adf_data, cbify::all, VW::alloc_examples(), CB::cb_label, label_parser::default_label, vw::interactions, and cbify_adf_data::num_actions.
Referenced by cbify_setup().
float loss | ( | cbify & | data, |
uint32_t | label, | ||
uint32_t | final_prediction | ||
) |
Definition at line 60 of file cbify.cc.
References cbify::loss0, and cbify::loss1.
Referenced by MULTICLASS::finish_example(), MWT::finish_example(), Search::search::get_metatask_data(), EXPLORE_EVAL::output_example(), VW::cb_explore_adf::cb_explore_adf_base< ExploreType >::output_example(), CB_ALGS::output_example(), MULTILABEL::output_example(), CB_EXPLORE::output_example(), COST_SENSITIVE::output_example(), output_example(), CSOAA::output_example(), CCB::output_example(), CSOAA::output_rank_example(), Search::search::predict(), EntityRelationTask::predict_entity(), predict_or_learn(), predict_or_learn_adf(), EntityRelationTask::predict_relation(), Search::search::predictLDF(), ArgmaxTask::run(), Search::search_declare_loss(), VW::sync_stats(), shared_data::update(), CB_ADF::cb_adf::update_statistics(), and vw::vw().
float loss_cs | ( | cbify & | data, |
v_array< COST_SENSITIVE::wclass > & | costs, | ||
uint32_t | final_prediction | ||
) |
Definition at line 68 of file cbify.cc.
References cbify::loss0, and cbify::loss1.
Referenced by predict_or_learn(), and predict_or_learn_adf().
float loss_csldf | ( | cbify & | data, |
std::vector< v_array< COST_SENSITIVE::wclass >> & | cs_costs, | ||
uint32_t | final_prediction | ||
) |
Definition at line 82 of file cbify.cc.
References cbify::loss0, and cbify::loss1.
Referenced by do_actual_learning_ldf().
Definition at line 304 of file cbify.cc.
References COST_SENSITIVE::label::costs, polylabel::cs, COST_SENSITIVE::cs_label, COST_SENSITIVE::ec_is_example_header(), example_is_newline(), vw::final_prediction_sink, example::l, loss(), polyprediction::multiclass, example::num_features, example::pred, vw::print, vw::print_text, COST_SENSITIVE::print_update(), vw::raw_prediction, vw::sd, v_array< T >::size(), shared_data::sum_loss, shared_data::sum_loss_since_last_dump, example::tag, test_label(), and shared_data::total_features.
Referenced by output_example_seq().
Definition at line 356 of file cbify.cc.
References shared_data::example_number, output_example(), vw::print_text, vw::raw_prediction, vw::sd, and shared_data::weighted_labeled_examples.
Referenced by EXPLORE_EVAL::finish_multiline_example(), finish_multiline_example(), CB_ADF::finish_multiline_example(), and CSOAA::finish_multiline_example().
void predict_or_learn | ( | cbify & | data, |
single_learner & | base, | ||
example & | ec | ||
) |
Definition at line 130 of file cbify.cc.
References cbify::a_s, polyprediction::a_s, CB::cb_class::action, cbify::app_seed, ACTION_SCORE::begin_scores(), polylabel::cb, cbify::cb_label, v_array< T >::clear(), CB::cb_class::cost, CB::label::costs, COST_SENSITIVE::label::costs, polylabel::cs, ACTION_SCORE::end_scores(), cbify::example_counter, example::l, MULTICLASS::label_t::label, LEARNER::learner< T, E >::learn(), loss(), loss_cs(), polylabel::multi, polyprediction::multiclass, example::pred, LEARNER::learner< T, E >::predict(), CB::cb_class::probability, exploration::sample_after_normalizing(), and THROW.
void predict_or_learn_adf | ( | cbify & | data, |
multi_learner & | base, | ||
example & | ec | ||
) |
Definition at line 183 of file cbify.cc.
References CB::cb_class::action, cbify::adf_data, cbify::app_seed, ACTION_SCORE::begin_scores(), copy_example_to_adf(), CB::cb_class::cost, COST_SENSITIVE::label::costs, polylabel::cs, cbify_adf_data::ecs, ACTION_SCORE::end_scores(), cbify::example_counter, example::l, MULTICLASS::label_t::label, LEARNER::learner< T, E >::learn(), loss(), loss_cs(), polylabel::multi, polyprediction::multiclass, example::pred, LEARNER::learner< T, E >::predict(), CB::cb_class::probability, exploration::sample_after_normalizing(), and THROW.