Vowpal Wabbit
Namespaces | Classes | Typedefs | Functions | Variables
VW Namespace Reference

[Error Generator] More...

Namespaces

 binary
 
 cats_tree
 
 cb_continuous
 
 cb_explore_adf
 
 cbzo
 
 config
 
 continuous_action
 
 continuous_actions
 
 details
 
 distributionally_robust
 
 error_code
 
 experimental
 
 io
 
 LEARNER
 Contains the VW::LEARNER::learner object and utilities for interacting with it.
 
 math
 
 offset_tree
 
 parsers
 
 pmf_to_pdf
 
 shared_feature_merger
 
 slates
 

Classes

struct  default_cleanup
 
struct  default_initializer
 
struct  kskip_ngram_transformer
 
struct  moved_object_pool
 
class  named_labels
 
struct  no_lock_object_pool
 
struct  object_pool
 
struct  primitive_feature_space
 
class  ptr_queue
 
class  SpanningTree
 
class  strict_parse_exception
 
struct  version_struct
 
class  vw_argument_disagreement_exception
 
class  vw_argument_invalid_value_exception
 
class  vw_exception
 
class  vw_unrecognised_option_exception
 

Typedefs

using decision_scores_t = std::vector< ACTION_SCORE::action_scores >
 
typedef example &(* example_factory_t) (void *)
 
template<typename T >
using v_array_pool = VW::moved_object_pool< v_array< T >>
 
using string_view = boost::string_ref
 

Functions

uint32_t convert (size_t number)
 
int string_cpy (char *dest, size_t dest_size, const char *src)
 
int file_open (FILE **pf, const char *filename, const char *mode)
 
void print_decision_scores (VW::io::writer *f, const VW::decision_scores_t &decision_scores)
 
void print_update_ccb (vw &all, std::vector< example * > &slots, const VW::decision_scores_t &decision_scores, size_t num_features)
 
void print_update_slates (vw &all, std::vector< example * > &slots, const VW::decision_scores_t &decision_scores, size_t num_features)
 
void return_multiple_example (vw &all, v_array< example * > &examples)
 
VW_STD14_CONSTEXPR float fast_pow10 (int8_t exponent)
 
template<typename T >
details::swap_guard_impl< T > swap_guard (T &original_location, T &value_to_swap) noexcept
 
template<typename T >
details::swap_guard_impl_rvalue< T > swap_guard (T &original_location, T &&value_to_swap) noexcept
 
template<typename T >
details::swap_guard_impl_rvalue< T > stash_guard (T &original_location) noexcept
 
template<typename T , typename... Args>
std::unique_ptr< T > make_unique (Args &&...params)
 
template<typename RetType , typename InputType >
RetType cast_to_smaller_type (InputType input)
 
template<typename RetType , typename InputType >
RetType cast_signed_to_unsigned (InputType input)
 
exampleget_unused_example (vw *all)
 
void read_line (vw &all, example *ex, char *line)
 
void read_lines (vw *all, const char *line, size_t len, v_array< example * > &examples)
 
template<bool audit>
void read_line_json (vw &all, v_array< example * > &examples, char *line, example_factory_t example_factory, void *ex_factory_context, std::unordered_map< uint64_t, example * > *dedup_examples=nullptr)
 
void apply_pdrop (vw &all, float pdrop, v_array< example * > &examples)
 
template<bool audit>
void read_line_decision_service_json (vw &all, v_array< example * > &examples, char *line, size_t length, bool copy_line, example_factory_t example_factory, void *ex_factory_context, DecisionServiceInteraction *data)
 
template<typename TScopeExitLambda >
details::scope_exit_caller< TScopeExitLambda > scope_exit (TScopeExitLambda &&lambda) noexcept
 
bool try_extract_random_seed (const example &ex, VW::string_view &view)
 
vwinitialize (std::unique_ptr< config::options_i, options_deleter_type > options, io_buf *model=nullptr, bool skipModelLoad=false, trace_message_t trace_listener=nullptr, void *trace_context=nullptr)
 
vwinitialize (config::options_i &options, io_buf *model=nullptr, bool skipModelLoad=false, trace_message_t trace_listener=nullptr, void *trace_context=nullptr)
 
vwinitialize (std::string s, io_buf *model=nullptr, bool skipModelLoad=false, trace_message_t trace_listener=nullptr, void *trace_context=nullptr)
 
vwinitialize (int argc, char *argv[], io_buf *model=nullptr, bool skipModelLoad=false, trace_message_t trace_listener=nullptr, void *trace_context=nullptr)
 
vwseed_vw_model (vw *vw_model, std::string extra_args, trace_message_t trace_listener=nullptr, void *trace_context=nullptr)
 
vwinitialize_escaped (std::string const &s, io_buf *model=nullptr, bool skipModelLoad=false, trace_message_t trace_listener=nullptr, void *trace_context=nullptr)
 
void cmd_string_replace_value (std::stringstream *&ss, std::string flag_to_replace, std::string new_value)
 
char ** get_argv_from_string (std::string s, int &argc)
 
char ** to_argv (std::string const &s, int &argc)
 
char ** to_argv_escaped (std::string const &s, int &argc)
 
void free_args (int argc, char *argv[])
 
const char * are_features_compatible (vw &vw1, vw &vw2)
 
void finish (vw &all, bool delete_all=true)
 
void sync_stats (vw &all)
 
void start_parser (vw &all)
 
void end_parser (vw &all)
 
bool is_ring_example (vw &all, example *ae)
 
exampleread_example (vw &all, char *example_line)
 
exampleread_example (vw &all, std::string example_line)
 
exampleimport_example (vw &all, const std::string &label, primitive_feature_space *features, size_t len)
 
examplealloc_examples (size_t, size_t count)
 
examplealloc_examples (size_t count)
 
 VW_DEPRECATED ("This interface is deprecated and unsafe. Deletion function pointers are no longer needed. Please use ""dealloc_examples") void dealloc_example(void(*delete_label)(polylabel *)
 
void dealloc_examples (example *example_ptr, size_t count)
 
void parse_example_label (vw &all, example &ec, std::string label)
 
void setup_examples (vw &all, v_array< example * > &examples)
 
void setup_example (vw &all, example *ae)
 
examplenew_unused_example (vw &all)
 
exampleget_example (parser *pf)
 
float get_topic_prediction (example *ec, size_t i)
 
float get_label (example *ec)
 
float get_importance (example *ec)
 
float get_initial (example *ec)
 
float get_prediction (example *ec)
 
float get_cost_sensitive_prediction (example *ec)
 
v_array< float > & get_cost_sensitive_prediction_confidence_scores (example *ec)
 
uint32_t * get_multilabel_predictions (example *ec, size_t &len)
 
float get_action_score (example *ec, size_t i)
 
size_t get_action_score_length (example *ec)
 
size_t get_tag_length (example *ec)
 
const char * get_tag (example *ec)
 
size_t get_feature_number (example *ec)
 
float get_confidence (example *ec)
 
featureget_features (vw &all, example *ec, size_t &feature_number)
 
void return_features (feature *f)
 
void add_constant_feature (vw &all, example *ec)
 
void add_label (example *ec, float label, float weight=1, float base=0)
 
void finish_example (vw &all, example &ec)
 
void finish_example (vw &all, multi_ex &ec)
 
void empty_example (vw &all, example &ec)
 
void copy_example_data (bool audit, example *, example *, size_t, void(*copy_label)(polylabel *, polylabel *))
 
void copy_example_data (bool audit, example *, example *, void(*copy_label)(polylabel *, polylabel *))
 
void copy_example_metadata (bool audit, example *, example *)
 
void copy_example_data (bool audit, example *, example *)
 
void move_feature_namespace (example *dst, example *src, namespace_index c)
 
primitive_feature_spaceexport_example (vw &all, example *e, size_t &len)
 
void releaseFeatureSpace (primitive_feature_space *features, size_t len)
 
void save_predictor (vw &all, std::string reg_name)
 
void save_predictor (vw &all, io_buf &buf)
 
uint64_t hash_space (vw &all, const std::string &s)
 
uint64_t hash_space_static (const std::string &s, const std::string &hash)
 
uint64_t hash_space_cstr (vw &all, const char *fstr)
 
uint64_t hash_feature (vw &all, const std::string &s, uint64_t u)
 
uint64_t hash_feature_static (const std::string &s, uint64_t u, const std::string &h, uint32_t num_bits)
 
uint64_t hash_feature_cstr (vw &all, char *fstr, uint64_t u)
 
uint64_t chain_hash (vw &all, const std::string &name, const std::string &value, uint64_t u)
 
float get_weight (vw &all, uint32_t index, uint32_t offset)
 
void set_weight (vw &all, uint32_t index, uint32_t offset, float value)
 
uint32_t num_weights (vw &all)
 
uint32_t get_stride (vw &all)
 
void init_features (primitive_feature_space &fs, size_t features_count)
 
void set_feature (primitive_feature_space &fs, size_t index, uint64_t feature_hash, float value)
 
std::string strerror_to_string (int error_number)
 
void validate_version (vw &all)
 
void validate_min_max_label (vw &all)
 
void validate_default_bits (vw &all, uint32_t local_num_bits)
 
void validate_num_bits (vw &all)
 

Variables

constexpr float UNUSED_0 = 0.f
 
constexpr float UNUSED_1 = 1.f
 
const version_struct version
 
const std::string git_commit
 
exampleec
 
example void(* delete_prediction )(void *) = nullptr)
 

Detailed Description

[Error Generator]

Typedef Documentation

using VW::decision_scores_t = typedef std::vector<ACTION_SCORE::action_scores>
typedef example&(* VW::example_factory_t) (void *)
using VW::string_view = typedef boost::string_ref
template<typename T >
using VW::v_array_pool = typedef VW::moved_object_pool<v_array<T>>

Function Documentation

void VW::add_constant_feature ( vw all,
example ec 
)
void VW::add_label ( example ec,
float  label,
float  weight = 1,
float  base = 0 
)
example* VW::alloc_examples ( size_t  ,
size_t  count 
)
example* VW::alloc_examples ( size_t  count)
void VW::apply_pdrop ( vw all,
float  pdrop,
v_array< example * > &  examples 
)
inline
const char* VW::are_features_compatible ( vw vw1,
vw vw2 
)
template<typename RetType , typename InputType >
RetType VW::cast_signed_to_unsigned ( InputType  input)
template<typename RetType , typename InputType >
RetType VW::cast_to_smaller_type ( InputType  input)
uint64_t VW::chain_hash ( vw all,
const std::string &  name,
const std::string &  value,
uint64_t  u 
)
inline
void VW::cmd_string_replace_value ( std::stringstream *&  ss,
std::string  flag_to_replace,
std::string  new_value 
)
uint32_t VW::convert ( size_t  number)
void VW::copy_example_data ( bool  audit,
example ,
example ,
size_t  ,
void(*)(polylabel *, polylabel *)  copy_label 
)
void VW::copy_example_data ( bool  audit,
example ,
example ,
void(*)(polylabel *, polylabel *)  copy_label 
)
void VW::copy_example_data ( bool  audit,
example ,
example  
)
void VW::copy_example_metadata ( bool  audit,
example ,
example  
)
void VW::dealloc_examples ( example example_ptr,
size_t  count 
)
void VW::empty_example ( vw all,
example ec 
)
void VW::end_parser ( vw all)
primitive_feature_space* VW::export_example ( vw all,
example e,
size_t &  len 
)
VW_STD14_CONSTEXPR float VW::fast_pow10 ( int8_t  exponent)
inline
int VW::file_open ( FILE **  pf,
const char *  filename,
const char *  mode 
)
inline
void VW::finish ( vw all,
bool  delete_all = true 
)
void VW::finish_example ( vw all,
example ec 
)
void VW::finish_example ( vw all,
multi_ex ec 
)
void VW::free_args ( int  argc,
char *  argv[] 
)
float VW::get_action_score ( example ec,
size_t  i 
)
size_t VW::get_action_score_length ( example ec)
char** VW::get_argv_from_string ( std::string  s,
int &  argc 
)
float VW::get_confidence ( example ec)
float VW::get_cost_sensitive_prediction ( example ec)
v_array<float>& VW::get_cost_sensitive_prediction_confidence_scores ( example ec)
example* VW::get_example ( parser pf)
size_t VW::get_feature_number ( example ec)
feature* VW::get_features ( vw all,
example ec,
size_t &  feature_number 
)
float VW::get_importance ( example ec)
float VW::get_initial ( example ec)
float VW::get_label ( example ec)
uint32_t* VW::get_multilabel_predictions ( example ec,
size_t &  len 
)
float VW::get_prediction ( example ec)
uint32_t VW::get_stride ( vw all)
inline
const char* VW::get_tag ( example ec)
size_t VW::get_tag_length ( example ec)
float VW::get_topic_prediction ( example ec,
size_t  i 
)
example& VW::get_unused_example ( vw all)
float VW::get_weight ( vw all,
uint32_t  index,
uint32_t  offset 
)
inline
uint64_t VW::hash_feature ( vw all,
const std::string &  s,
uint64_t  u 
)
inline
uint64_t VW::hash_feature_cstr ( vw all,
char *  fstr,
uint64_t  u 
)
inline
uint64_t VW::hash_feature_static ( const std::string &  s,
uint64_t  u,
const std::string &  h,
uint32_t  num_bits 
)
inline
uint64_t VW::hash_space ( vw all,
const std::string &  s 
)
inline
uint64_t VW::hash_space_cstr ( vw all,
const char *  fstr 
)
inline
uint64_t VW::hash_space_static ( const std::string &  s,
const std::string &  hash 
)
inline
example* VW::import_example ( vw all,
const std::string &  label,
primitive_feature_space features,
size_t  len 
)
void VW::init_features ( primitive_feature_space fs,
size_t  features_count 
)
inline
vw* VW::initialize ( std::unique_ptr< config::options_i, options_deleter_type options,
io_buf model = nullptr,
bool  skipModelLoad = false,
trace_message_t  trace_listener = nullptr,
void *  trace_context = nullptr 
)
vw* VW::initialize ( config::options_i options,
io_buf model = nullptr,
bool  skipModelLoad = false,
trace_message_t  trace_listener = nullptr,
void *  trace_context = nullptr 
)
vw* VW::initialize ( std::string  s,
io_buf model = nullptr,
bool  skipModelLoad = false,
trace_message_t  trace_listener = nullptr,
void *  trace_context = nullptr 
)
vw* VW::initialize ( int  argc,
char *  argv[],
io_buf model = nullptr,
bool  skipModelLoad = false,
trace_message_t  trace_listener = nullptr,
void *  trace_context = nullptr 
)
vw* VW::initialize_escaped ( std::string const &  s,
io_buf model = nullptr,
bool  skipModelLoad = false,
trace_message_t  trace_listener = nullptr,
void *  trace_context = nullptr 
)
bool VW::is_ring_example ( vw all,
example ae 
)
template<typename T , typename... Args>
std::unique_ptr<T> VW::make_unique ( Args &&...  params)
void VW::move_feature_namespace ( example dst,
example src,
namespace_index  c 
)
example* VW::new_unused_example ( vw all)
uint32_t VW::num_weights ( vw all)
inline
void VW::parse_example_label ( vw all,
example ec,
std::string  label 
)
void VW::print_decision_scores ( VW::io::writer f,
const VW::decision_scores_t decision_scores 
)
void VW::print_update_ccb ( vw all,
std::vector< example * > &  slots,
const VW::decision_scores_t decision_scores,
size_t  num_features 
)
void VW::print_update_slates ( vw all,
std::vector< example * > &  slots,
const VW::decision_scores_t decision_scores,
size_t  num_features 
)
example* VW::read_example ( vw all,
char *  example_line 
)
example* VW::read_example ( vw all,
std::string  example_line 
)
void VW::read_line ( vw all,
example ex,
char *  line 
)
template<bool audit>
void VW::read_line_decision_service_json ( vw all,
v_array< example * > &  examples,
char *  line,
size_t  length,
bool  copy_line,
example_factory_t  example_factory,
void *  ex_factory_context,
DecisionServiceInteraction data 
)
template<bool audit>
void VW::read_line_json ( vw all,
v_array< example * > &  examples,
char *  line,
example_factory_t  example_factory,
void *  ex_factory_context,
std::unordered_map< uint64_t, example * > *  dedup_examples = nullptr 
)
void VW::read_lines ( vw all,
const char *  line,
size_t  len,
v_array< example * > &  examples 
)
void VW::releaseFeatureSpace ( primitive_feature_space features,
size_t  len 
)
void VW::return_features ( feature f)
void VW::return_multiple_example ( vw all,
v_array< example * > &  examples 
)
void VW::save_predictor ( vw all,
std::string  reg_name 
)
void VW::save_predictor ( vw all,
io_buf buf 
)
template<typename TScopeExitLambda >
details::scope_exit_caller<TScopeExitLambda> VW::scope_exit ( TScopeExitLambda &&  lambda)
inlinenoexcept

Created an RAII object which executes the provided lambda when the scope exits. The primary use case is to handle cleanup in code where exceptions are possible but the code is not exception safe.

#### Example:

{
auto* resource = /* some_resource_that_needs_cleanup */;
auto guard = VW::scope_exit([resource]() { /* cleanup_resource(resource); */ });
}
// Lambda has executed at this point.
vw* VW::seed_vw_model ( vw vw_model,
std::string  extra_args,
trace_message_t  trace_listener = nullptr,
void *  trace_context = nullptr 
)
void VW::set_feature ( primitive_feature_space fs,
size_t  index,
uint64_t  feature_hash,
float  value 
)
inline
void VW::set_weight ( vw all,
uint32_t  index,
uint32_t  offset,
float  value 
)
inline
void VW::setup_example ( vw all,
example ae 
)
void VW::setup_examples ( vw all,
v_array< example * > &  examples 
)
void VW::start_parser ( vw all)
template<typename T >
details::swap_guard_impl_rvalue<T> VW::stash_guard ( T &  original_location)
inlinenoexcept

This guard will replace the location with a default constructed object on creation and upon deletion swap the original value back. This guard is equivalent to swap_guard<T>(xxx, T())

#### Example:

void use_widget(widget& my_widget)
{
auto new_widget_value = ::get_new_widget_value();
auto temp = std::move(my_widget.value);
my_widget.value = std::move(new_widget_value);
do_thing_with_widget(my_widget);
new_widget_value = std::move(my_widget.value);
my_widget.value = std::move(temp);
}
// Can be replaced with:
void use_widget(widget& my_widget)
{
auto guard = VW::swap_guard(my_widget.value, ::get_new_widget_value(););
do_thing_with_widget(my_widget);
}
std::string VW::strerror_to_string ( int  error_number)
inline
int VW::string_cpy ( char *  dest,
size_t  dest_size,
const char *  src 
)
inline
template<typename T >
details::swap_guard_impl<T> VW::swap_guard ( T &  original_location,
T &  value_to_swap 
)
inlinenoexcept

This guard will swap the two locations on creation and upon deletion swap them back.

#### Example:

void use_widget(widget& my_widget)
{
auto new_widget_value = ::get_new_widget_value();
auto temp = std::move(my_widget.value);
my_widget.value = std::move(new_widget_value);
do_thing_with_widget(my_widget);
new_widget_value = std::move(my_widget.value);
my_widget.value = std::move(temp);
}
// Can be replaced with:
void use_widget(widget& my_widget)
{
auto new_widget_value = ::get_new_widget_value();
auto guard = VW::swap_guard(my_widget.value, new_widget_value);
do_thing_with_widget(my_widget);
}
template<typename T >
details::swap_guard_impl_rvalue<T> VW::swap_guard ( T &  original_location,
T &&  value_to_swap 
)
inlinenoexcept

This guard will swap the two locations on creation and upon deletion swap them back. Note: This overload allows for a temporary value to be passed in.

#### Example:

void use_widget(widget& my_widget)
{
auto new_widget_value = ::get_new_widget_value();
auto temp = std::move(my_widget.value);
my_widget.value = std::move(new_widget_value);
do_thing_with_widget(my_widget);
new_widget_value = std::move(my_widget.value);
my_widget.value = std::move(temp);
}
// Can be replaced with:
void use_widget(widget& my_widget)
{
auto guard = VW::swap_guard(my_widget.value, ::get_new_widget_value(););
do_thing_with_widget(my_widget);
}
void VW::sync_stats ( vw all)
char** VW::to_argv ( std::string const &  s,
int &  argc 
)
char** VW::to_argv_escaped ( std::string const &  s,
int &  argc 
)
bool VW::try_extract_random_seed ( const example ex,
VW::string_view view 
)
void VW::validate_default_bits ( vw all,
uint32_t  local_num_bits 
)
void VW::validate_min_max_label ( vw all)
void VW::validate_num_bits ( vw all)
void VW::validate_version ( vw all)
VW::VW_DEPRECATED ( "This interface is deprecated and unsafe. Deletion function pointers are no longer needed. Please use ""dealloc_examples )

Variable Documentation

example void(* VW::delete_prediction) (void *) = nullptr)
example& VW::ec
const std::string VW::git_commit
constexpr float VW::UNUSED_0 = 0.f
constexpr float VW::UNUSED_1 = 1.f
const version_struct VW::version