Vowpal Wabbit
Functions
stagewise_poly.h File Reference

Go to the source code of this file.

Functions

LEARNER::base_learnerstagewise_poly_setup (VW::config::options_i &options, vw &all)
 

Function Documentation

◆ stagewise_poly_setup()

LEARNER::base_learner* stagewise_poly_setup ( VW::config::options_i options,
vw all 
)

Definition at line 656 of file stagewise_poly.cc.

References VW::config::option_group_definition::add(), add(), VW::config::options_i::add_and_parse(), LEARNER::as_singleline(), depthsbits_create(), LEARNER::end_pass(), finish_example(), LEARNER::init_learner(), learn(), LEARNER::make_base(), VW::config::make_option(), predict(), save_load(), LEARNER::learner< T, E >::set_end_pass(), LEARNER::learner< T, E >::set_finish_example(), LEARNER::learner< T, E >::set_save_load(), setup_base(), and sort_data_create().

Referenced by parse_reductions().

657 {
658  auto poly = scoped_calloc_or_throw<stagewise_poly>();
659  bool stage_poly = false;
660  option_group_definition new_options("Stagewise polynomial options");
661  new_options.add(make_option("stage_poly", stage_poly).keep().help("use stagewise polynomial feature learning"))
662  .add(make_option("sched_exponent", poly->sched_exponent)
663  .default_value(1.f)
664  .help("exponent controlling quantity of included features"))
665  .add(make_option("batch_sz", poly->batch_sz)
666  .default_value(1000)
667  .help("multiplier on batch size before including more features"))
668  .add(make_option("batch_sz_no_doubling", poly->batch_sz_double).help("batch_sz does not double"));
669 #ifdef MAGIC_ARGUMENT
670  new_options.add(
671  make_typed_option("magic_argument", poly->magic_argument).default_value(0.).help("magical feature flag"));
672 #endif // MAGIC_ARGUMENT
673  options.add_and_parse(new_options);
674 
675  if (!stage_poly)
676  return nullptr;
677 
678  poly->all = &all;
679  depthsbits_create(*poly.get());
680  sort_data_create(*poly.get());
681 
682  poly->batch_sz_double = !poly->batch_sz_double;
683 
684  poly->sum_sparsity = 0;
685  poly->sum_input_sparsity = 0;
686  poly->num_examples = 0;
687  poly->sum_sparsity_sync = 0;
688  poly->sum_input_sparsity_sync = 0;
689  poly->num_examples_sync = 0;
690  poly->last_example_counter = -1;
691  poly->numpasses = 1;
692  poly->update_support = false;
693  poly->original_ec = nullptr;
694  poly->next_batch_sz = poly->batch_sz;
695 
700 
701  return make_base(l);
702 }
void finish_example(vw &all, stagewise_poly &poly, example &ec)
void sort_data_create(stagewise_poly &poly)
base_learner * make_base(learner< T, E > &base)
Definition: learner.h:462
virtual void add_and_parse(const option_group_definition &group)=0
void set_save_load(void(*sl)(T &, io_buf &, bool, bool))
Definition: learner.h:257
single_learner * as_singleline(learner< T, E > *l)
Definition: learner.h:476
void set_finish_example(void(*f)(vw &all, T &, E &))
Definition: learner.h:307
learner< T, E > & init_learner(free_ptr< T > &dat, L *base, void(*learn)(T &, L &, E &), void(*predict)(T &, L &, E &), size_t ws, prediction_type::prediction_type_t pred_type)
Definition: learner.h:369
void save_load(stagewise_poly &poly, io_buf &model_file, bool read, bool text)
int add(svm_params &params, svm_example *fec)
Definition: kernel_svm.cc:546
typed_option< T > make_option(std::string name, T &location)
Definition: options.h:80
void set_end_pass(void(*f)(T &))
Definition: learner.h:286
LEARNER::base_learner * setup_base(options_i &options, vw &all)
Definition: parse_args.cc:1222
void depthsbits_create(stagewise_poly &poly)
void end_pass(stagewise_poly &poly)
void learn(stagewise_poly &poly, single_learner &base, example &ec)
void predict(stagewise_poly &poly, single_learner &base, example &ec)