504 auto tree = scoped_calloc_or_throw<recall_tree>();
506 new_options.add(
make_option(
"recall_tree", tree->k).keep().help(
"Use online tree for multiclass"))
509 .help(
"maximum number of labels per leaf in the tree"))
510 .
add(
make_option(
"bern_hyper", tree->bern_hyper).default_value(1.
f).help(
"recall tree depth penalty"))
511 .
add(
make_option(
"max_depth", tree->max_depth).keep().help(
"maximum depth of the tree, default log_2 (#classes)"))
512 .
add(
make_option(
"node_only", tree->node_only).keep().help(
"only use node features, not full path features"))
513 .
add(
make_option(
"randomized_routing", tree->randomized_routing).keep().help(
"randomized routing"));
521 tree->max_candidates = options.
was_supplied(
"max_candidates")
522 ? tree->max_candidates
523 : std::min(tree->k, 4 * (uint32_t)(ceil(log(tree->k) / log(2.0))));
525 options.
was_supplied(
"max_depth") ? tree->max_depth : (uint32_t)std::ceil(std::log(tree->k) / std::log(2.0));
531 <<
" node_only = " << tree->node_only <<
" bern_hyper = " << tree->bern_hyper
532 <<
" max_depth = " << tree->max_depth <<
" routing = " 533 << (all.
training ? (tree->randomized_routing ?
"randomized" :
"deterministic") :
"n/a testonly")
base_learner * make_base(learner< T, E > &base)
void predict(recall_tree &b, single_learner &base, example &ec)
virtual void add_and_parse(const option_group_definition &group)=0
void set_save_load(void(*sl)(T &, io_buf &, bool, bool))
std::shared_ptr< rand_state > get_random_state()
single_learner * as_singleline(learner< T, E > *l)
void learn(recall_tree &b, single_learner &base, example &ec)
virtual bool was_supplied(const std::string &key)=0
int add(svm_params ¶ms, svm_example *fec)
void save_load_tree(log_multi &b, io_buf &model_file, bool read, bool text)
typed_option< T > make_option(std::string name, T &location)
void init_tree(log_multi &d)
learner< T, E > & init_multiclass_learner(free_ptr< T > &dat, L *base, void(*learn)(T &, L &, E &), void(*predict)(T &, L &, E &), parser *p, size_t ws, prediction_type::prediction_type_t pred_type=prediction_type::multiclass)
LEARNER::base_learner * setup_base(options_i &options, vw &all)