|
void | debug_log_message (example &ec, const std::string &msg) |
|
void | debug_log_message (multi_ex &ec, const std::string &msg) |
|
void | learn (E &ec, size_t i=0) |
| Will update the model according to the labels and examples supplied. More...
|
|
void | predict (E &ec, size_t i=0) |
| Make a prediction for the given example. More...
|
|
void | multipredict (E &ec, size_t lo, size_t count, polyprediction *pred, bool finalize_predictions) |
|
template<class L > |
void | set_predict (void(*u)(T &, L &, E &)) |
|
template<class L > |
void | set_learn (void(*u)(T &, L &, E &)) |
|
template<class L > |
void | set_multipredict (void(*u)(T &, L &, E &, size_t, size_t, polyprediction *, bool)) |
|
void | update (E &ec, size_t i=0) |
|
template<class L > |
void | set_update (void(*u)(T &data, L &base, E &)) |
|
void | set_sensitivity (float(*u)(T &data, base_learner &base, example &)) |
|
float | sensitivity (example &ec, size_t i=0) |
|
void | save_load (io_buf &io, const bool read, const bool text) |
|
void | set_save_load (void(*sl)(T &, io_buf &, bool, bool)) |
|
void | persist_metrics (metric_sink &metrics) |
|
void | set_persist_metrics (void(*f)(T &, metric_sink &)) |
|
void | set_finish (void(*f)(T &)) |
|
void | finish () |
|
void | end_pass () |
|
void | set_end_pass (void(*f)(T &)) |
|
void | end_examples () |
|
void | set_end_examples (void(*f)(T &)) |
|
void | init_driver () |
|
void | set_init_driver (void(*f)(T &)) |
|
void | finish_example (vw &all, E &ec) |
|
void | set_finish_example (void(*f)(vw &all, T &, E &)) |
|
void | set_print_example (void(*f)(vw &all, T &, E &)) |
|
void | print_example (vw &all, E &ec) |
|
base_learner * | get_learner_by_name_prefix (std::string reduction_name) |
|
template<class T, class E>
struct VW::LEARNER::learner< T, E >
Defines the interface for a learning algorithm.
Learner is implemented as a struct of pointers, and associated methods. It implements a sort of virtual inheritance through the use of bundling function pointers with the associated objects to call them with. A reduction will recursively call the base given to it, whereas a base learner will not recurse and will simply return the result. Learner is not intended to be inherited from. Instead it is used through composition, and created through the various VW::LEARNER::init_learner overloaded functions that chain to the central factor function VW::LEARNER::learner::init_learner The state of this learner, or reduction, is stored in the learner_data field. A std::shared_pointer<void>
is used as this class uses type erasure to allow for an arbitrary reduction to be implemented. It is extremely important that the function pointers given to the class match the expected types of the object. If the learner is constructed using VW::LEARNER::learner::init_learner and assembled before it is transformed into a VW::LEARNER::base_learner with VW::LEARNER::make_base then the usage of the templated functions should ensure types are correct.
- Template Parameters
-
T | Type of the reduction data object stored. This allows this specific reduction to have it's own state. |
E | Example type this reduction supports. Must be one of example or multi_ex |