Vowpal Wabbit
|
Classes | |
struct | audit_results |
struct | gd |
struct | multipredict_info |
struct | norm_data |
struct | power_data |
class | set_initial_gd_wrapper |
struct | string_value |
struct | trunc_data |
Functions | |
void | sync_weights (vw &all) |
float | quake_InvSqrt (float x) |
static float | InvSqrt (float x) |
template<bool sqrt_rate, bool feature_mask_off, size_t adaptive, size_t normalized, size_t spare> | |
void | update_feature (float &update, float x, float &fw) |
template<bool sqrt_rate, size_t adaptive, size_t normalized> | |
float | average_update (float total_weight, float normalized_sum_norm_x, float neg_norm_power) |
template<bool sqrt_rate, bool feature_mask_off, size_t adaptive, size_t normalized, size_t spare> | |
void | train (gd &g, example &ec, float update) |
void | end_pass (gd &g) |
bool | operator< (const string_value &first, const string_value &second) |
void | audit_interaction (audit_results &dat, const audit_strings *f) |
void | audit_feature (audit_results &dat, const float ft_weight, const uint64_t ft_idx) |
void | print_lda_features (vw &all, example &ec) |
void | print_features (vw &all, example &ec) |
void | print_audit_features (vw &all, example &ec) |
float | finalize_prediction (shared_data *sd, float ret) |
void | vec_add_trunc (trunc_data &p, const float fx, float &fw) |
float | trunc_predict (vw &all, example &ec, double gravity) |
void | vec_add_print (float &p, const float fx, float &fw) |
template<bool l1, bool audit> | |
void | predict (gd &g, base_learner &, example &ec) |
template<class T > | |
void | vec_add_trunc_multipredict (multipredict_info< T > &mp, const float fx, uint64_t fi) |
template<bool l1, bool audit> | |
void | multipredict (gd &g, base_learner &, example &ec, size_t count, size_t step, polyprediction *pred, bool finalize_predictions) |
template<bool sqrt_rate, size_t adaptive, size_t normalized> | |
float | compute_rate_decay (power_data &s, float &fw) |
template<bool sqrt_rate, bool feature_mask_off, size_t adaptive, size_t normalized, size_t spare, bool stateless> | |
void | pred_per_update_feature (norm_data &nd, float x, float &fw) |
template<bool sqrt_rate, bool feature_mask_off, bool adax, size_t adaptive, size_t normalized, size_t spare, bool stateless> | |
float | get_pred_per_update (gd &g, example &ec) |
template<bool sqrt_rate, bool feature_mask_off, bool adax, size_t adaptive, size_t normalized, size_t spare, bool stateless> | |
float | sensitivity (gd &g, example &ec) |
template<size_t adaptive> | |
float | get_scale (gd &g, example &, float weight) |
template<bool sqrt_rate, bool feature_mask_off, bool adax, size_t adaptive, size_t normalized, size_t spare> | |
float | sensitivity (gd &g, base_learner &, example &ec) |
template<bool sparse_l2, bool invariant, bool sqrt_rate, bool feature_mask_off, bool adax, size_t adaptive, size_t normalized, size_t spare> | |
float | compute_update (gd &g, example &ec) |
template<bool sparse_l2, bool invariant, bool sqrt_rate, bool feature_mask_off, bool adax, size_t adaptive, size_t normalized, size_t spare> | |
void | update (gd &g, base_learner &, example &ec) |
template<bool sparse_l2, bool invariant, bool sqrt_rate, bool feature_mask_off, bool adax, size_t adaptive, size_t normalized, size_t spare> | |
void | learn (gd &g, base_learner &base, example &ec) |
size_t | write_index (io_buf &model_file, std::stringstream &msg, bool text, uint32_t num_bits, uint64_t i) |
template<class T > | |
void | save_load_regressor (vw &all, io_buf &model_file, bool read, bool text, T &weights) |
void | save_load_regressor (vw &all, io_buf &model_file, bool read, bool text) |
template<class T > | |
void | save_load_online_state (vw &all, io_buf &model_file, bool read, bool text, gd *g, std::stringstream &msg, uint32_t ftrl_size, T &weights) |
void | save_load_online_state (vw &all, io_buf &model_file, bool read, bool text, double &total_weight, gd *g, uint32_t ftrl_size) |
void | save_load (gd &g, io_buf &model_file, bool read, bool text) |
template<bool sparse_l2, bool invariant, bool sqrt_rate, bool feature_mask_off, uint64_t adaptive, uint64_t normalized, uint64_t spare, uint64_t next> | |
uint64_t | set_learn (vw &all, gd &g) |
template<bool sparse_l2, bool invariant, bool sqrt_rate, uint64_t adaptive, uint64_t normalized, uint64_t spare, uint64_t next> | |
uint64_t | set_learn (vw &all, bool feature_mask_off, gd &g) |
template<bool invariant, bool sqrt_rate, uint64_t adaptive, uint64_t normalized, uint64_t spare, uint64_t next> | |
uint64_t | set_learn (vw &all, bool feature_mask_off, gd &g) |
template<bool sqrt_rate, uint64_t adaptive, uint64_t normalized, uint64_t spare, uint64_t next> | |
uint64_t | set_learn (vw &all, bool feature_mask_off, gd &g) |
template<bool sqrt_rate, uint64_t adaptive, uint64_t spare> | |
uint64_t | set_learn (vw &all, bool feature_mask_off, gd &g) |
template<bool sqrt_rate> | |
uint64_t | set_learn (vw &all, bool feature_mask_off, gd &g) |
uint64_t | ceil_log_2 (uint64_t v) |
base_learner * | setup (options_i &options, vw &all) |
template<class T > | |
void | vec_add_multipredict (multipredict_info< T > &mp, const float fx, uint64_t fi) |
template<class R , typename T > | |
void | foreach_feature (vw &all, features &fs, R &dat, uint64_t offset=0, float mult=1.) |
template<class R , class S , void(*)(R &, float, S) T> | |
void | foreach_feature (vw &all, example &ec, R &dat) |
template<class R , void(*)(R &, float, float &) T> | |
void | foreach_feature (vw &all, example &ec, R &dat) |
float | inline_predict (vw &all, example &ec) |
float | sign (float w) |
float | trunc_weight (const float w, const float gravity) |
template<class R , void(*)(R &, float, uint64_t) T, class W > | |
void | foreach_feature (W &, features &fs, R &dat, uint64_t offset=0, float mult=1.) |
template<class R , void(*)(R &, const float, const float &) T, class W > | |
void | foreach_feature (const W &weights, features &fs, R &dat, uint64_t offset=0, float mult=1.) |
template<class R > | |
void | dummy_func (R &, const audit_strings *) |
template<class R , class S , void(*)(R &, float, S) T, class W > | |
void | generate_interactions (std::vector< std::string > &interactions, bool permutations, example_predict &ec, R &dat, W &weights) |
template<class R , class S , void(*)(R &, float, S) T, class W > | |
void | foreach_feature (W &weights, bool ignore_some_linear, std::array< bool, NUM_NAMESPACES > &ignore_linear, std::vector< std::string > &interactions, bool permutations, example_predict &ec, R &dat) |
void | vec_add (float &p, const float fx, const float &fw) |
template<class W > | |
float | inline_predict (W &weights, bool ignore_some_linear, std::array< bool, NUM_NAMESPACES > &ignore_linear, std::vector< std::string > &interactions, bool permutations, example_predict &ec, float initial=0.f) |
Variables | |
constexpr float | x_min = 1.084202e-19f |
constexpr float | x2_min = x_min * x_min |
constexpr float | x2_max = FLT_MAX |
bool | global_print_features = false |
|
inline |
Definition at line 241 of file gd.cc.
References parameters::adaptive, GD::audit_results::all, vw::audit, shared_data::contraction, vw::current_pass, shared_data::gravity, vw::hash_inv, parameters::mask(), vw::name_index_map, GD::audit_results::ns_pre, GD::audit_results::offset, GD::audit_results::results, vw::sd, stride_shift(), parameters::stride_shift(), vw::training, trunc_weight(), and vw::weights.
Referenced by print_features().
|
inline |
Definition at line 208 of file gd.cc.
References GD::audit_results::ns_pre.
Referenced by print_features().
float GD::average_update | ( | float | total_weight, |
float | normalized_sum_norm_x, | ||
float | neg_norm_power | ||
) |
|
inline |
Definition at line 447 of file gd.cc.
References InvSqrt(), GD::power_data::minus_power_t, GD::power_data::neg_norm_power, and ldamath::powf().
float GD::compute_update | ( | gd & | g, |
example & | ec | ||
) |
Definition at line 609 of file gd.cc.
References GD::gd::all, shared_data::contraction, loss_function::first_derivative(), loss_function::getLoss(), loss_function::getUnsafeUpdate(), loss_function::getUpdate(), shared_data::gravity, example::l, vw::l1_lambda, vw::l2_lambda, label_data::label, vw::loss, example::pred, vw::reg_mode, polyprediction::scalar, vw::sd, polylabel::simple, GD::gd::sparse_l2, update(), example::updated_prediction, and example::weight.
|
inline |
Definition at line 39 of file gd_predict.h.
void GD::end_pass | ( | gd & | g | ) |
Definition at line 148 of file gd.cc.
References accumulate_avg(), accumulate_weighted_avg(), parameters::adaptive, GD::gd::all, vw::all_reduce, vw::check_holdout_every_n_passes, shared_data::contraction, vw::current_pass, GD::gd::early_stop_thres, vw::eta, vw::eta_decay_rate, vw::final_regressor_name, finalize_regressor(), VW::config::options_i::get_typed_option(), shared_data::gravity, vw::holdout_set_off, GD::gd::no_win_counter, vw::options, VW::config::options_i::replace(), vw::save_per_pass, save_predictor(), vw::save_resume, vw::sd, set_done(), summarize_holdout_set(), sync_weights(), prediction_type::to_string(), and vw::weights.
float GD::finalize_prediction | ( | shared_data * | sd, |
float | ret | ||
) |
Definition at line 339 of file gd.cc.
References shared_data::example_number, shared_data::max_label, and shared_data::min_label.
Referenced by bfgs_predict(), mf_predict(), multipredict(), multipredict(), SVRG::predict(), predict(), predict(), predict_or_learn_multi(), SVRG::predict_stable(), update_state_and_predict_cb(), and update_state_and_predict_pistol().
|
inline |
|
inline |
|
inline |
Definition at line 56 of file gd_predict.h.
References example_predict::begin(), example_predict::end(), f, and example_predict::ft_offset.
|
inline |
Definition at line 66 of file gd.h.
References parameters::dense_weights, parameters::sparse, parameters::sparse_weights, and vw::weights.
Referenced by foreach_feature(), and get_pred_per_update().
|
inline |
Definition at line 75 of file gd.h.
References parameters::dense_weights, vw::ignore_linear, vw::ignore_some_linear, example_predict::interactions, vw::permutations, parameters::sparse, parameters::sparse_weights, and vw::weights.
|
inline |
Definition at line 87 of file gd.h.
References foreach_feature().
|
inline |
Definition at line 45 of file gd_predict.h.
float GD::get_pred_per_update | ( | gd & | g, |
example & | ec | ||
) |
Definition at line 541 of file gd.cc.
References GD::gd::all, foreach_feature(), loss_function::getSquareGrad(), example::l, label_data::label, vw::loss, GD::gd::neg_norm_power, GD::gd::neg_power_t, GD::norm_data::norm_x, vw::normalized_sum_norm_x, example::pred, GD::norm_data::pred_per_update, polyprediction::scalar, polylabel::simple, GD::gd::total_weight, GD::gd::update_multiplier, and example::weight.
Definition at line 588 of file gd.cc.
References GD::gd::all, vw::eta, GD::gd::neg_power_t, ldamath::powf(), vw::sd, shared_data::t, shared_data::weighted_holdout_examples, and shared_data::weighted_unlabeled_examples.
|
inline |
Definition at line 78 of file gd_predict.h.
Definition at line 98 of file gd.h.
References parameters::dense_weights, vw::ignore_linear, vw::ignore_some_linear, label_data::initial, example_predict::interactions, example::l, vw::permutations, polylabel::simple, parameters::sparse, parameters::sparse_weights, and vw::weights.
Referenced by bfgs_predict(), predict(), and predict().
|
inlinestatic |
Definition at line 80 of file gd.cc.
References quake_InvSqrt().
Referenced by compute_rate_decay().
void GD::learn | ( | gd & | g, |
base_learner & | base, | ||
example & | ec | ||
) |
Definition at line 661 of file gd.cc.
References example::in_use, example::l, label_data::label, GD::gd::predict, polylabel::simple, and example::weight.
void GD::multipredict | ( | gd & | g, |
base_learner & | , | ||
example & | ec, | ||
size_t | count, | ||
size_t | step, | ||
polyprediction * | pred, | ||
bool | finalize_predictions | ||
) |
Definition at line 402 of file gd.cc.
References GD::gd::all, c, shared_data::contraction, parameters::dense_weights, finalize_prediction(), example_predict::ft_offset, shared_data::gravity, label_data::initial, example::l, example::pred, print_audit_features(), prediction_type::scalar, polyprediction::scalar, vw::sd, polylabel::simple, parameters::sparse, parameters::sparse_weights, vec_add_multipredict(), vec_add_trunc_multipredict(), and vw::weights.
bool GD::operator< | ( | const string_value & | first, |
const string_value & | second | ||
) |
Definition at line 197 of file gd.cc.
References GD::string_value::v.
|
inline |
Definition at line 488 of file gd.cc.
References GD::norm_data::extra_state, GD::norm_data::grad_squared, GD::power_data::neg_norm_power, GD::norm_data::norm_x, GD::norm_data::pd, ldamath::powf(), GD::norm_data::pred_per_update, THROW, and x2_min.
void GD::predict | ( | gd & | g, |
base_learner & | , | ||
example & | ec | ||
) |
Definition at line 379 of file gd.cc.
References GD::gd::all, shared_data::contraction, finalize_prediction(), shared_data::gravity, inline_predict(), example::partial_prediction, example::pred, print_audit_features(), polyprediction::scalar, vw::sd, and trunc_predict().
Definition at line 331 of file gd.cc.
References vw::audit, example::pred, print_features(), print_result(), polyprediction::scalar, vw::stdout_fileno, and example::tag.
Referenced by learn_batch(), multipredict(), multipredict(), predict(), and predict().
Definition at line 298 of file gd.cc.
References audit_feature(), audit_interaction(), f, example_predict::ft_offset, vw::lda, print_lda_features(), GD::audit_results::results, and GD::string_value::s.
Referenced by print_audit_features().
Definition at line 280 of file gd.cc.
References f, vw::lda, vw::parse_mask, stride_shift(), parameters::stride_shift(), and vw::weights.
Referenced by print_features().
|
inline |
Definition at line 992 of file gd.cc.
References parameters::adaptive, GD::gd::all, bin_text_read_write_fixed(), constant, parameters::dense_weights, io_buf::files, GD::gd::initial_constant, vw::initial_t, vw::initial_weight, initialize_regressor(), vw::model_file_ver, save_load_online_state(), save_load_regressor(), vw::save_resume, dense_parameters::set_default(), sparse_parameters::set_default(), VW::set_weight(), v_array< T >::size(), parameters::sparse, parameters::sparse_weights, sync_weights(), GD::gd::total_weight, vw::trace_message, vw::training, VERSION_SAVE_RESUME_FIX, and vw::weights.
Referenced by setup().
void GD::save_load_online_state | ( | vw & | all, |
io_buf & | model_file, | ||
bool | read, | ||
bool | text, | ||
gd * | g, | ||
std::stringstream & | msg, | ||
uint32_t | ftrl_size, | ||
T & | weights | ||
) |
Definition at line 776 of file gd.cc.
References parameters::adaptive, GD::gd::adaptive_input, io_buf::bin_read_fixed(), bin_text_write_fixed(), parameters::normalized, GD::gd::normalized_input, vw::num_bits, THROW, vw::weights, and write_index().
Referenced by SVRG::save_load(), and save_load().
void GD::save_load_online_state | ( | vw & | all, |
io_buf & | model_file, | ||
bool | read, | ||
bool | text, | ||
double & | total_weight, | ||
gd * | g, | ||
uint32_t | ftrl_size | ||
) |
Definition at line 881 of file gd.cc.
References bin_text_read_write_fixed(), vw::current_pass, parameters::dense_weights, shared_data::dump_interval, shared_data::example_number, vw::initial_t, shared_data::max_label, shared_data::min_label, vw::model_file_ver, vw::normalized_sum_norm_x, shared_data::old_weighted_labeled_examples, vw::preserve_performance_counters, vw::sd, parameters::sparse, parameters::sparse_weights, shared_data::sum_loss, shared_data::sum_loss_since_last_dump, shared_data::t, shared_data::total_features, vw::training, VERSION_PASS_UINT64, VERSION_SAVE_RESUME_FIX, shared_data::weighted_labeled_examples, shared_data::weighted_labels, shared_data::weighted_unlabeled_examples, and vw::weights.
Referenced by save_load().
void GD::save_load_regressor | ( | vw & | all, |
io_buf & | model_file, | ||
bool | read, | ||
bool | text, | ||
T & | weights | ||
) |
Definition at line 707 of file gd.cc.
References io_buf::bin_read_fixed(), bin_text_write_fixed(), vw::name_index_map, vw::num_bits, vw::print_invert, THROW, and write_index().
Referenced by SVRG::save_load(), and save_load().
Definition at line 767 of file gd.cc.
References parameters::dense_weights, parameters::sparse, parameters::sparse_weights, and vw::weights.
Referenced by save_load().
float GD::sensitivity | ( | gd & | g, |
example & | ec | ||
) |
Definition at line 579 of file gd.cc.
References example::total_sum_feat_sq.
float GD::sensitivity | ( | gd & | g, |
base_learner & | , | ||
example & | ec | ||
) |
uint64_t GD::set_learn | ( | vw & | all, |
gd & | g | ||
) |
Definition at line 1044 of file gd.cc.
References GD::gd::adax, GD::gd::learn, vw::normalized_idx, GD::gd::sensitivity, and GD::gd::update.
uint64_t GD::set_learn | ( | vw & | all, |
bool | feature_mask_off, | ||
gd & | g | ||
) |
Definition at line 1065 of file gd.cc.
References vw::normalized_idx.
uint64_t GD::set_learn | ( | vw & | all, |
bool | feature_mask_off, | ||
gd & | g | ||
) |
Definition at line 1075 of file gd.cc.
References GD::gd::sparse_l2.
uint64_t GD::set_learn | ( | vw & | all, |
bool | feature_mask_off, | ||
gd & | g | ||
) |
Definition at line 1084 of file gd.cc.
References vw::invariant_updates.
uint64_t GD::set_learn | ( | vw & | all, |
bool | feature_mask_off, | ||
gd & | g | ||
) |
Definition at line 1093 of file gd.cc.
References parameters::normalized, and vw::weights.
LEARNER::base_learner * GD::setup | ( | options_i & | options, |
vw & | all | ||
) |
Definition at line 1119 of file gd.cc.
References parameters::adaptive, VW::config::option_group_definition::add(), add(), VW::config::options_i::add_and_parse(), vw::audit, ceil_log_2(), shared_data::contraction, LEARNER::end_pass(), vw::eta, vw::eta_decay_rate, f, VW::config::options_i::get_typed_option(), shared_data::gravity, vw::hash_inv, shared_data::holdout_best_loss, vw::holdout_set_off, LEARNER::init_learner(), vw::initial_constant, vw::initial_t, vw::invariant_updates, LEARNER::make_base(), VW::config::make_option(), GD::gd::multipredict, parameters::normalized, vw::normalized_sum_norm_x, vw::numpasses, vw::power_t, ldamath::powf(), GD::gd::predict, vw::reg_mode, save_load(), vw::save_resume, vw::sd, GD::gd::sensitivity, LEARNER::learner< T, E >::set_end_pass(), LEARNER::learner< T, E >::set_multipredict(), LEARNER::learner< T, E >::set_save_load(), LEARNER::learner< T, E >::set_sensitivity(), LEARNER::learner< T, E >::set_update(), shared_data::t, THROW, vw::trace_message, vw::training, GD::gd::update, VW::config::options_i::was_supplied(), and vw::weights.
Referenced by parse_reductions().
|
inline |
Definition at line 106 of file gd.h.
Referenced by trunc_weight().
void GD::sync_weights | ( | vw & | all | ) |
Definition at line 671 of file gd.cc.
References shared_data::contraction, parameters::dense_weights, shared_data::gravity, vw::sd, parameters::sparse, parameters::sparse_weights, trunc_weight(), and vw::weights.
Referenced by end_pass(), save_load(), and update().
void GD::train | ( | gd & | g, |
example & | ec, | ||
float | update | ||
) |
Definition at line 141 of file gd.cc.
References GD::gd::all, update(), and GD::gd::update_multiplier.
Definition at line 365 of file gd.cc.
References label_data::initial, example::l, GD::trunc_data::prediction, and polylabel::simple.
Referenced by predict().
|
inline |
Definition at line 114 of file gd.h.
References GD::multipredict_info< T >::gravity, and sign().
Referenced by audit_feature(), sync_weights(), vec_add_trunc(), and vec_add_trunc_multipredict().
void GD::update | ( | gd & | g, |
base_learner & | , | ||
example & | ec | ||
) |
Definition at line 647 of file gd.cc.
References sync_weights().
Referenced by compute_update(), mf_train(), and train().
|
inline |
|
inline |
Definition at line 75 of file gd_predict.h.
|
inline |
Definition at line 40 of file gd.h.
References c, GD::multipredict_info< T >::count, GD::multipredict_info< T >::pred, polyprediction::scalar, GD::multipredict_info< T >::step, and GD::multipredict_info< T >::weights.
Referenced by multipredict(), and multipredict().
|
inline |
|
inline |
Definition at line 360 of file gd.cc.
References GD::trunc_data::gravity, GD::trunc_data::prediction, and trunc_weight().
|
inline |
Definition at line 394 of file gd.cc.
References c, GD::multipredict_info< T >::count, GD::multipredict_info< T >::gravity, GD::multipredict_info< T >::pred, polyprediction::scalar, GD::multipredict_info< T >::step, trunc_weight(), and GD::multipredict_info< T >::weights.
Referenced by multipredict().
size_t GD::write_index | ( | io_buf & | model_file, |
std::stringstream & | msg, | ||
bool | text, | ||
uint32_t | num_bits, | ||
uint64_t | i | ||
) |
Definition at line 688 of file gd.cc.
References bin_text_write_fixed().
Referenced by save_load_online_state(), and save_load_regressor().
Definition at line 484 of file gd.cc.
Referenced by pred_per_update_feature().