Vowpal Wabbit
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Typedefs | Functions
learner.h File Reference
#include "vw/common/future_compat.h"
#include "vw/common/string_view.h"
#include "vw/core/debug_log.h"
#include "vw/core/example.h"
#include "vw/core/global_data.h"
#include "vw/core/label_type.h"
#include "vw/core/learner_fwd.h"
#include "vw/core/memory.h"
#include "vw/core/metric_sink.h"
#include "vw/core/polymorphic_ex.h"
#include "vw/core/prediction_type.h"
#include "vw/core/scope_exit.h"
#include "vw/core/shared_data.h"
#include "vw/core/simple_label.h"
#include "vw/core/vw.h"
#include <functional>
#include <iostream>
#include <memory>

Classes

class  VW::LEARNER::learner
 Defines the interface for a learning algorithm. More...
 
class  VW::LEARNER::common_learner_builder< FluentBuilderT, DataT, ExampleT >
 
class  VW::LEARNER::reduction_learner_builder< DataT, ExampleT >
 
class  VW::LEARNER::reduction_no_data_learner_builder< ExampleT >
 
class  VW::LEARNER::bottom_learner_builder< DataT, ExampleT >
 

Namespaces

namespace  VW
 
namespace  VW::LEARNER
 Contains the VW::LEARNER::learner object and utilities for interacting with it.
 
namespace  VW::LEARNER::details
 

Macros

#define VW_DEBUG_LOG   vw_dbg::LEARNER
 
#define LEARNER_BUILDER_DEFINE(func, ...)
 

Typedefs

template<typename DataT , typename ExampleT >
using VW::learner_update_stats_func = void(const VW::workspace &all, shared_data &sd, const DataT &, const ExampleT &, VW::io::logger &logger)
 
template<typename DataT , typename ExampleT >
using VW::learner_output_example_prediction_func = void(VW::workspace &all, const DataT &, const ExampleT &, VW::io::logger &logger)
 
template<typename DataT , typename ExampleT >
using VW::learner_print_update_func = void(VW::workspace &all, shared_data &, const DataT &, const ExampleT &, VW::io::logger &logger)
 
template<typename DataT , typename ExampleT >
using VW::learner_cleanup_example_func = void(DataT &, ExampleT &)
 
using VW::LEARNER::details::void_func = std::function< void(void)>
 
using VW::LEARNER::details::example_func = std::function< void(polymorphic_ex ex)>
 
using VW::LEARNER::details::multipredict_func = std::function< void(polymorphic_ex ex, size_t count, size_t step, polyprediction *pred, bool finalize_predictions)>
 
using VW::LEARNER::details::sensitivity_func = std::function< float(example &ex)>
 
using VW::LEARNER::details::save_load_func = std::function< void(io_buf &, bool read, bool text)>
 
using VW::LEARNER::details::pre_save_load_func = std::function< void(VW::workspace &all)>
 
using VW::LEARNER::details::save_metric_func = std::function< void(metric_sink &metrics)>
 
using VW::LEARNER::details::finish_example_func = std::function< void(VW::workspace &, polymorphic_ex ex)>
 
using VW::LEARNER::details::update_stats_func = std::function< void(const VW::workspace &, VW::shared_data &sd, const polymorphic_ex ex, VW::io::logger &logger)>
 
using VW::LEARNER::details::output_example_prediction_func = std::function< void(VW::workspace &, const polymorphic_ex ex, VW::io::logger &logger)>
 
using VW::LEARNER::details::print_update_func = std::function< void(VW::workspace &, VW::shared_data &sd, const polymorphic_ex ex, VW::io::logger &logger)>
 
using VW::LEARNER::details::cleanup_example_func = std::function< void(polymorphic_ex ex)>
 
using VW::LEARNER::details::merge_func = std::function< void(const std::vector< float > &per_model_weighting, const std::vector< const void * > &all_data, void *output_data)>
 
using VW::LEARNER::details::merge_with_all_func = std::function< void(const std::vector< float > &per_model_weighting, const std::vector< const VW::workspace * > &all_workspaces, const std::vector< const void * > &all_data, VW::workspace &output_workspace, void *output_data)>
 
using VW::LEARNER::details::add_subtract_func = std::function< void(const void *data1, const void *data2, void *data_out)>
 
using VW::LEARNER::details::add_subtract_with_all_func = std::function< void(const VW::workspace &ws1, const void *data1, const VW::workspace &ws2, const void *data2, VW::workspace &ws_out, void *data_out)>
 

Functions

void VW::LEARNER::generic_driver (VW::workspace &all)
 
void VW::LEARNER::generic_driver (const std::vector< VW::workspace * > &alls)
 
void VW::LEARNER::generic_driver_onethread (VW::workspace &all)
 
bool VW::LEARNER::ec_is_example_header (example const &ec, label_type_t label_type)
 
learner * VW::LEARNER::require_multiline (learner *l)
 
learner * VW::LEARNER::require_singleline (learner *l)
 
std::shared_ptr< learner > VW::LEARNER::require_multiline (std::shared_ptr< learner > l)
 
std::shared_ptr< learner > VW::LEARNER::require_singleline (std::shared_ptr< learner > l)
 
void VW::LEARNER::details::debug_increment_depth (polymorphic_ex ex)
 
void VW::LEARNER::details::debug_decrement_depth (polymorphic_ex ex)
 
void VW::LEARNER::details::increment_offset (polymorphic_ex ex, const size_t feature_width_below, const size_t i)
 
void VW::LEARNER::details::decrement_offset (polymorphic_ex ex, const size_t feature_width_below, const size_t i)
 
void VW::LEARNER::details::learner_build_diagnostic (VW::string_view this_name, VW::string_view base_name, prediction_type_t in_pred_type, prediction_type_t base_out_pred_type, label_type_t out_label_type, label_type_t base_in_label_type, details::merge_func merge_f, details::merge_with_all_func merge_with_all_f)
 
template<bool is_learn>
void VW::LEARNER::multiline_learn_or_predict (learner &base, multi_ex &examples, const uint64_t offset, const uint32_t id=0)
 
float VW::LEARNER::details::recur_sensitivity (learner &base, example &ec)
 
template<typename DataT >
float VW::LEARNER::details::recur_sensitivity (DataT &, learner &base, example &ec)
 
template<class DataT , class ExampleT >
reduction_learner_builder< DataT, ExampleT > VW::LEARNER::make_reduction_learner (std::unique_ptr< DataT > &&data, std::shared_ptr< learner > base, void(*learn_fn)(DataT &, learner &, ExampleT &), void(*predict_fn)(DataT &, learner &, ExampleT &), const std::string &name)
 
template<class ExampleT >
reduction_no_data_learner_builder< ExampleT > VW::LEARNER::make_no_data_reduction_learner (std::shared_ptr< learner > base, void(*learn_fn)(learner &, ExampleT &), void(*predict_fn)(learner &, ExampleT &), const std::string &name)
 
template<class DataT , class ExampleT >
bottom_learner_builder< DataT, ExampleT > VW::LEARNER::make_bottom_learner (std::unique_ptr< DataT > &&data, void(*learn_fn)(DataT &, ExampleT &), void(*predict_fn)(DataT &, ExampleT &), const std::string &name, prediction_type_t out_pred_type, label_type_t in_label_type)
 
template<class ExampleT >
bottom_learner_builder< char, ExampleT > VW::LEARNER::make_no_data_bottom_learner (void(*learn_fn)(char &, ExampleT &), void(*predict_fn)(char &, ExampleT &), const std::string &name, prediction_type_t out_pred_type, label_type_t in_label_type)
 

Macro Definition Documentation

◆ LEARNER_BUILDER_DEFINE

#define LEARNER_BUILDER_DEFINE (   func,
  ... 
)
Value:
FluentBuilderT& func& { __VA_ARGS__ return static_cast<FluentBuilderT&>(*this); } \
FluentBuilderT&& func&& { __VA_ARGS__ return static_cast<FluentBuilderT&&>(*this); }

◆ VW_DEBUG_LOG

#define VW_DEBUG_LOG   vw_dbg::LEARNER