Vowpal Wabbit
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
VW Namespace Reference

Namespaces

namespace  cb_continuous
 
namespace  cb_explore_adf
 
 
namespace  config
 
namespace  continuous_actions
 
namespace  debug
 
namespace  details
 
namespace  estimators
 
namespace  experimental
 
namespace  explore
 
namespace  io
 
namespace  known_alignments
 
namespace  large_action_space
 
namespace  LEARNER
 Contains the VW::LEARNER::learner object and utilities for interacting with it.
 
namespace  math
 
namespace  model_utils
 
namespace  parsers
 
namespace  reductions
 
namespace  slates
 
namespace  version_definitions
 

Classes

class  action_score
 
class  action_scores_score_iterator
 
class  active_multiclass_prediction
 
class  all_reduce_base
 
class  all_reduce_sockets
 
class  all_reduce_sync
 
class  all_reduce_threads
 
class  audit_strings
 
class  cached_learner
 
class  cb_class
 
class  cb_eval_label
 
class  cb_label
 
class  cb_with_observations_label
 
class  ccb_label
 
class  ccb_outcome
 
class  ccb_reduction_features
 
class  column_definition
 
class  cs_class
 
class  cs_label
 
class  default_reduction_stack_setup
 
class  dense_parameters
 
struct  desired_align
 
class  example
 
class  example_predict
 
class  feature
 
class  features
 the core definition of a set of features. More...
 
class  generic_range
 
class  generic_range< IteratorT, typename std::enable_if< std::is_const< IteratorT >::value >::type >
 
class  generic_range< IteratorT, typename std::enable_if<!std::is_const< IteratorT >::value >::type >
 
class  interactions_generator
 
class  io_buf
 
struct  is_example_type
 
struct  is_multiline_type
 
struct  is_nonqualified_example_type
 
class  kskip_ngram_transformer
 
class  label_parser
 
class  label_parser_reuse_mem
 
class  loss_function
 
class  metric_sink
 
class  metric_sink_visitor
 
class  metrics_collector
 
class  model_delta
 
class  moved_object_pool
 
class  multiclass_label
 
class  multilabel_label
 
class  multilabel_prediction
 
class  named_labels
 
class  namespace_extent
 
struct  no_label
 
struct  no_pred
 
class  parameters
 
class  parser
 
class  polylabel
 
class  polymorphic_ex
 
class  polyprediction
 
class  primitive_feature_space
 
class  rand_state
 
class  reduction_features
 
class  save_load_model_exception
 
class  setup_base_i
 
class  shared_data
 
class  simple_label
 
class  simple_label_reduction_features
 
class  spanning_tree
 
class  sparse_parameters
 
class  strict_parse_exception
 
class  thread_pool
 
class  thread_safe_queue
 
class  threads_joiner
 
class  v_array
 This is a diagnostic overload used to prevent v_array from being used with types that are not trivially copyable. More...
 
class  v_array< T, typename std::enable_if< std::is_trivially_copyable< T >::value >::type >
 v_array is a container type that makes use of realloc for efficiency. However, it is only safe to use trivially copyable types, as std::realloc may do a memcpy if a new piece of memory must be allocated. More...
 
class  version_struct
 
class  vw_argument_disagreement_exception
 
class  vw_argument_invalid_value_exception
 
class  vw_exception
 
class  vw_unrecognised_option_exception
 
class  workspace
 

Typedefs

using string_view = nonstd::string_view
 
using action_scores = VW::v_array< action_score >
 
using weight = float
 
using multi_ex = std::vector< example * >
 
using decision_scores_t = std::vector< VW::action_scores >
 
using trace_message_t = void(*)(void *, const std::string &)
 
using example_factory_t = std::function< example &()>
 
using namespace_index = unsigned char
 
using feature_value = float
 
using feature_index = uint64_t
 
using extent_term = std::pair< namespace_index, uint64_t >
 
using options_deleter_type = void(*)(VW::config::options_i *)
 
using hash_func_t = uint32_t(*)(const char *, size_t, uint32_t)
 
template<typename T >
using generate_func_t = std::vector< std::vector< T > >(const std::set< T > &namespaces, size_t num_to_pick)
 
template<typename DataT , typename ExampleT >
using 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 learner_output_example_prediction_func = void(VW::workspace &all, const DataT &, const ExampleT &, VW::io::logger &logger)
 
template<typename DataT , typename ExampleT >
using learner_print_update_func = void(VW::workspace &all, shared_data &, const DataT &, const ExampleT &, VW::io::logger &logger)
 
template<typename DataT , typename ExampleT >
using learner_cleanup_example_func = void(DataT &, ExampleT &)
 
template<typename T , typename TInitializer = details::default_factory<T>>
using no_lock_object_pool = details::object_pool_impl< T, details::null_mutex, TInitializer >
 
template<typename T , typename TInitializer = details::default_factory<T>>
using object_pool = details::object_pool_impl< T, std::mutex, TInitializer >
 
using reduction_setup_fn = std::shared_ptr< VW::LEARNER::learner >(*)(VW::setup_base_i &)
 
template<typename T >
using v_array_pool = VW::moved_object_pool< v_array< T > >
 
template<typename T >
using vector_pool = VW::moved_object_pool< std::vector< T > >
 
using driver_output_func_t = VW::trace_message_t
 
using example_sink_f = std::function< void(VW::multi_ex &&spare_examples)>
 
using SpanningTree = spanning_tree
 

Enumerations

enum class  all_reduce_type { SOCKET , THREAD }
 
enum class  cb_type_t : uint32_t {
  DR , DM , IPS , MTR ,
  SM
}
 
enum class  ccb_example_type : uint8_t { UNSET = 0 , SHARED = 1 , ACTION = 2 , SLOT = 3 }
 
enum class  label_type_t : uint32_t {
  SIMPLE , CB , CB_EVAL , CB_WITH_OBSERVATIONS ,
  CS , MULTILABEL , MULTICLASS , CCB ,
  SLATES , NOLABEL , CONTINUOUS , simple = SIMPLE ,
  cb = CB , cb_eval = CB_EVAL , cs = CS , multilabel = MULTILABEL ,
  multiclass = MULTICLASS , ccb = CCB , slates = SLATES , nolabel = NOLABEL ,
  continuous = CONTINUOUS
}
 
enum class  prediction_type_t : uint32_t {
  SCALAR , SCALARS , ACTION_SCORES , PDF ,
  ACTION_PROBS , MULTICLASS , MULTILABELS , PROB ,
  MULTICLASS_PROBS , DECISION_PROBS , ACTION_PDF_VALUE , ACTIVE_MULTICLASS ,
  NOPRED , scalar = SCALAR , scalars = SCALARS , action_scores = ACTION_SCORES ,
  pdf = PDF , action_probs = ACTION_PROBS , multiclass = MULTICLASS , multilabels = MULTILABELS ,
  prob = PROB , multiclassprobs = MULTICLASS_PROBS , decision_probs = DECISION_PROBS , action_pdf_value = ACTION_PDF_VALUE ,
  active_multiclass = ACTIVE_MULTICLASS , nopred = NOPRED
}
 
enum class  wrap_type { truncate , truncate_with_ellipsis , wrap_space , wrap_char }
 
enum class  align_type { left , right }
 

Functions

VW_STD14_CONSTEXPR uint32_t uniform_hash (const char *data, size_t len, uint32_t seed)
 
template<typename ContainerT >
void tokenize (char delim, VW::string_view s, ContainerT &ret, bool allow_empty=false)
 
bool ends_with (VW::string_view full_string, VW::string_view ending)
 Check if a string ends with some other string. More...
 
bool starts_with (VW::string_view full_string, VW::string_view starting)
 Check if a string starts with some other string. More...
 
std::string wrap_text (VW::string_view text, size_t width, bool wrap_after=true)
 Wrap text by whole words with the given column width. More...
 
constexpr bool operator< (const action_score &left, const action_score &right)
 
constexpr bool operator> (const action_score &left, const action_score &right)
 
std::ostream & operator<< (std::ostream &os, const action_score &a_s)
 
std::string to_string (const action_scores &action_scores_or_probs, int decimal_precision=details::DEFAULT_FLOAT_PRECISION)
 
action_scores_score_iterator begin_scores (action_scores &a_s)
 
action_scores_score_iterator end_scores (action_scores &a_s)
 
std::string to_string (const VW::active_multiclass_prediction &active_multiclass)
 
VW::string_view to_string (reductions::automl::automl_state state)
 
VW::string_view to_string (reductions::automl::config_state state)
 
VW::string_view to_string (reductions::automl::config_type state)
 
void count_label (shared_data &sd, float l)
 
bool get_best_constant (const loss_function &loss_func, const shared_data &sd, float &best_constant, float &best_constant_loss)
 
void write_example_to_cache (io_buf &output, VW::example *ex_ptr, VW::label_parser &lbl_parser, uint64_t parse_mask, VW::parsers::cache::details::cache_temp_buffer &temp_buffer)
 
int read_example_from_cache (VW::workspace *all, io_buf &input, VW::multi_ex &examples)
 
bool ec_is_example_header_cb (VW::example const &ec)
 
std::pair< bool, cb_classget_observed_cost_cb (const cb_label &ld)
 
std::string to_string (const cb_continuous::continuous_label_elm &elm, int decimal_precision=details::DEFAULT_FLOAT_PRECISION)
 
std::string to_string (const cb_continuous::continuous_label &lbl, int decimal_precision=details::DEFAULT_FLOAT_PRECISION)
 
cb_type_t cb_type_from_string (string_view str)
 
string_view to_string (cb_type_t type)
 
bool ec_is_example_header_cb_with_observations (VW::example const &ec)
 
void parse_ccb_label (ccb_label &ld, VW::label_parser_reuse_mem &reuse_mem, const std::vector< VW::string_view > &words, VW::io::logger &logger)
 
const char * to_string (ccb_example_type type)
 
bool is_cs_example_header (const VW::example &ec)
 
int string_cpy (char *dest, size_t dest_size, const char *src)
 
int file_open (FILE **pf, const char *filename, const char *mode)
 
int get_pid ()
 
void print_decision_scores (VW::io::writer *f, const VW::decision_scores_t &decision_scores, VW::io::logger &logger)
 
std::string to_string (const VW::decision_scores_t &decision_scores, int decimal_precision=VW::details::DEFAULT_FLOAT_PRECISION)
 
void print_update_ccb (VW::workspace &all, const std::vector< example * > &slots, const VW::decision_scores_t &decision_scores, size_t num_features)
 
void print_update_slates (VW::workspace &all, const std::vector< example * > &slots, const VW::decision_scores_t &decision_scores, size_t num_features)
 
void copy_example_data (example *dst, const example *src)
 
void setup_example (VW::workspace &all, example *ae)
 
std::string to_string (const v_array< float > &scalars, int decimal_precision=details::DEFAULT_FLOAT_PRECISION)
 
void swap_prediction (polyprediction &a, polyprediction &b, prediction_type_t prediction_type)
 
void flatten_features (VW::workspace &all, example &ec, features &fs)
 
bool example_is_newline (const example &ec)
 
bool valid_ns (char c)
 
void return_multiple_example (VW::workspace &all, VW::multi_ex &examples)
 
VW_STD14_CONSTEXPR float fast_pow10 (int8_t exponent)
 
std::string to_string (const audit_strings &ai)
 
float features_dot_product (const features &fs1, const features &fs2)
 
template<class DataT , void(*)(DataT &, float feature_value, uint64_t feature_index) FuncT, class WeightsT >
void foreach_feature (WeightsT &, const VW::features &fs, DataT &dat, uint64_t offset=0, float mult=1.)
 
template<class DataT , void(*)(DataT &, float, float) FuncT, class WeightsT >
void foreach_feature (const WeightsT &weights, const VW::features &fs, DataT &dat, uint64_t offset=0, float mult=1.)
 
template<class DataT , class WeightOrIndexT , void(*)(DataT &, float, WeightOrIndexT) FuncT, class WeightsT >
void generate_interactions (const std::vector< std::vector< VW::namespace_index > > &interactions, const std::vector< std::vector< VW::extent_term > > &extent_interactions, bool permutations, VW::example_predict &ec, DataT &dat, WeightsT &weights, size_t &num_interacted_features, VW::details::generate_interactions_object_cache &cache)
 
template<class DataT , class WeightOrIndexT , void(*)(DataT &, float, WeightOrIndexT) FuncT, class WeightsT >
void foreach_feature (WeightsT &weights, bool ignore_some_linear, std::array< bool, VW::NUM_NAMESPACES > &ignore_linear, const std::vector< std::vector< VW::namespace_index > > &interactions, const std::vector< std::vector< VW::extent_term > > &extent_interactions, bool permutations, VW::example_predict &ec, DataT &dat, size_t &num_interacted_features, VW::details::generate_interactions_object_cache &cache)
 
template<class DataT , class WeightOrIndexT , void(*)(DataT &, float, WeightOrIndexT) FuncT, class WeightsT >
void foreach_feature (WeightsT &weights, bool ignore_some_linear, std::array< bool, VW::NUM_NAMESPACES > &ignore_linear, const std::vector< std::vector< VW::namespace_index > > &interactions, const std::vector< std::vector< VW::extent_term > > &extent_interactions, bool permutations, VW::example_predict &ec, DataT &dat, VW::details::generate_interactions_object_cache &cache)
 
template<class WeightsT >
float inline_predict (WeightsT &weights, bool ignore_some_linear, std::array< bool, VW::NUM_NAMESPACES > &ignore_linear, const std::vector< std::vector< VW::namespace_index > > &interactions, const std::vector< std::vector< VW::extent_term > > &extent_interactions, bool permutations, VW::example_predict &ec, VW::details::generate_interactions_object_cache &cache, float initial=0.f)
 
template<class WeightsT >
float inline_predict (WeightsT &weights, bool ignore_some_linear, std::array< bool, VW::NUM_NAMESPACES > &ignore_linear, const std::vector< std::vector< VW::namespace_index > > &interactions, const std::vector< std::vector< VW::extent_term > > &extent_interactions, bool permutations, VW::example_predict &ec, size_t &num_interacted_features, VW::details::generate_interactions_object_cache &cache, float initial=0.f)
 
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
 
hash_func_t get_hasher (const std::string &s)
 
constexpr bool is_interaction_ns (const unsigned char ns)
 
bool contains_wildcard (const std::vector< VW::namespace_index > &interaction)
 
bool contains_wildcard (const std::vector< VW::extent_term > &interaction)
 
float eval_sum_ft_squared_of_generated_ft (bool permutations, const std::vector< std::vector< VW::namespace_index > > &interactions, const std::vector< std::vector< VW::extent_term > > &extent_interactions, const std::array< VW::features, VW::NUM_NAMESPACES > &feature_spaces)
 
template<class DataT , class WeightOrIndexT , void(*)(DataT &, float, WeightOrIndexT) FuncT, bool audit, void(*)(DataT &, const VW::audit_strings *) audit_func, class WeightsT >
void generate_interactions (const std::vector< std::vector< VW::namespace_index > > &interactions, const std::vector< std::vector< VW::extent_term > > &extent_interactions, bool permutations, VW::example_predict &ec, DataT &dat, WeightsT &weights, size_t &num_features, VW::details::generate_interactions_object_cache &cache)
 
label_parser get_label_parser (VW::label_type_t label_type)
 
string_view to_string (VW::label_type_t)
 
std::unique_ptr< loss_functionget_loss_function (VW::workspace &, const std::string &funcName, float function_parameter_0=-1.0f, float function_parameter_1=1.0f)
 
template<typename T , typename... Args>
std::unique_ptr< T > make_unique (Args &&... params)
 
std::unique_ptr< VW::workspacemerge_models (const VW::workspace *base_workspace, const std::vector< const VW::workspace * > &workspaces_to_merge, VW::io::logger *logger=nullptr)
 
VW::model_delta merge_deltas (const std::vector< const VW::model_delta * > &deltas_to_merge, VW::io::logger *logger=nullptr)
 
std::unique_ptr< VW::workspaceoperator+ (const VW::workspace &ws, const VW::model_delta &md)
 
VW::model_delta operator- (const VW::workspace &ws1, const VW::workspace &ws2)
 
bool test_multiclass_label (const multiclass_label &ld)
 
std::string to_string (const VW::multilabel_label &multilabels)
 
std::string to_string (const VW::multilabel_prediction &multilabels)
 
template<typename RetType , typename InputType >
RetType cast_to_smaller_type (InputType input)
 
template<typename RetType , typename InputType >
RetType cast_signed_to_unsigned (InputType input)
 
template<typename RetType , typename InputType >
RetType cast_unsigned_to_signed (InputType input)
 
void read_line (VW::workspace &all, example *ex, VW::string_view line)
 
void read_line (VW::workspace &all, example *ex, const char *line)
 
void read_lines (VW::workspace *all, const char *line, size_t len, VW::multi_ex &examples)
 
void read_lines (VW::workspace *all, VW::string_view lines, VW::multi_ex &examples)
 
template<bool audit>
void read_line_json_s (const VW::label_parser &lbl_parser, hash_func_t hash_func, uint64_t hash_seed, uint64_t parse_mask, bool chain_hash, VW::label_parser_reuse_mem *reuse_mem, const VW::named_labels *ldict, VW::multi_ex &examples, char *line, size_t length, example_factory_t example_factory, VW::io::logger &logger, std::unordered_map< std::string, std::set< std::string > > *ignore_features, const std::unordered_map< uint64_t, VW::example * > *dedup_examples=nullptr)
 
template<bool audit>
void read_line_json_s (VW::workspace &all, VW::multi_ex &examples, char *line, size_t length, example_factory_t example_factory, const std::unordered_map< uint64_t, VW::example * > *dedup_examples=nullptr)
 
template<bool audit>
bool read_line_decision_service_json (VW::workspace &all, VW::multi_ex &examples, char *line, size_t length, bool copy_line, example_factory_t example_factory, VW::parsers::json::decision_service_interaction *data)
 
std::string trim_whitespace (const std::string &s)
 Trim whitespace from the beginning and end of a string. More...
 
VW::string_view trim_whitespace (VW::string_view str)
 Trim whitespace from the beginning and end of a string. More...
 
std::vector< std::string > split_command_line (const std::string &cmd_line)
 Split a string like a shell splits a command line. This function handles quotes and escapes. More...
 
std::vector< std::string > split_command_line (VW::string_view cmd_line)
 Split a string like a shell splits a command line. This function handles quotes and escapes. More...
 
std::vector< VW::string_viewsplit_by_limit (const VW::string_view &s, size_t limit)
 
void parse_example_label (string_view label, const VW::label_parser &lbl_parser, const named_labels *ldict, label_parser_reuse_mem &reuse_mem, example &ec, VW::io::logger &logger)
 
void setup_examples (VW::workspace &all, VW::multi_ex &examples)
 
VW::exampleget_unused_example (VW::workspace *all)
 
string_view to_string (prediction_type_t)
 
std::string to_string (const continuous_actions::probability_density_function_value &pdf_value, int decimal_precision=details::DEFAULT_FLOAT_PRECISION)
 
std::string to_string (const continuous_actions::probability_density_function &pdf, int decimal_precision=details::DEFAULT_FLOAT_PRECISION)
 
template<>
VW::ccb_reduction_featuresreduction_features::get< VW::ccb_reduction_features > ()
 
template<>
const VW::ccb_reduction_featuresreduction_features::get< VW::ccb_reduction_features > () const
 
template<>
VW::continuous_actions::reduction_featuresreduction_features::get< VW::continuous_actions::reduction_features > ()
 
template<>
const VW::continuous_actions::reduction_featuresreduction_features::get< VW::continuous_actions::reduction_features > () const
 
template<>
simple_label_reduction_featuresreduction_features::get< VW::simple_label_reduction_features > ()
 
template<>
const simple_label_reduction_featuresreduction_features::get< VW::simple_label_reduction_features > () const
 
template<>
VW::cb_explore_adf::greedy::reduction_featuresreduction_features::get< VW::cb_explore_adf::greedy::reduction_features > ()
 
template<>
const VW::cb_explore_adf::greedy::reduction_featuresreduction_features::get< VW::cb_explore_adf::greedy::reduction_features > () const
 
template<>
VW::large_action_space::las_reduction_featuresreduction_features::get< VW::large_action_space::las_reduction_features > ()
 
template<>
const VW::large_action_space::las_reduction_featuresreduction_features::get< VW::large_action_space::las_reduction_features > () const
 
template<>
VW::cb_graph_feedback::reduction_featuresreduction_features::get< VW::cb_graph_feedback::reduction_features > ()
 
template<>
const VW::cb_graph_feedback::reduction_featuresreduction_features::get< VW::cb_graph_feedback::reduction_features > () const
 
VW::exampletest_cb_adf_sequence (const VW::multi_ex &ec_seq, bool allow_multiple_costs=false)
 
VW::cb_class get_observed_cost_or_default_cb_adf (const VW::multi_ex &examples)
 
template<bool is_learn>
float get_cost_pred (VW::LEARNER::learner *scorer, const VW::cb_class &known_cost, VW::example &ec, uint32_t index, uint32_t base)
 
float get_cost_estimate (const VW::cb_class &observation, uint32_t action, float offset=0.)
 
float get_cost_estimate (const VW::cb_class &observation, const VW::cs_label &scores, uint32_t action)
 
float get_cost_estimate (const VW::cb_label &ld, uint32_t action)
 
float get_cost_estimate (const VW::action_score &a_s, float cost, uint32_t action, float offset=0.)
 
bool example_is_newline_not_header_cb (VW::example const &ec)
 
template<class DataT , class WeightOrIndexT , void(*)(DataT &, float, WeightOrIndexT) FuncT>
void foreach_feature (VW::workspace &all, VW::example &ec, DataT &dat)
 
template<class DataT , class WeightOrIndexT , void(*)(DataT &, float, WeightOrIndexT) FuncT>
void foreach_feature (VW::workspace &all, VW::example &ec, DataT &dat, size_t &num_interacted_features)
 
template<class DataT , void(*)(DataT &, float, float &) FuncT>
void foreach_feature (VW::workspace &all, VW::example &ec, DataT &dat)
 
template<class DataT , void(*)(DataT &, float, float &) FuncT>
void foreach_feature (VW::workspace &all, VW::example &ec, DataT &dat, size_t &num_interacted_features)
 
float inline_predict (VW::workspace &all, VW::example &ec)
 
float inline_predict (VW::workspace &all, VW::example &ec, size_t &num_generated_features)
 
float trunc_weight (const float w, const float gravity)
 
template<class R , class S , void(*)(R &, float, S) T, bool audit, void(*)(R &, const VW::audit_strings *) audit_func>
void generate_interactions (VW::workspace &all, VW::example_predict &ec, R &dat, size_t &num_interacted_features)
 
template<class R , class S , void(*)(R &, float, S) T>
void generate_interactions (VW::workspace &all, VW::example_predict &ec, R &dat, size_t &num_interacted_features)
 
template<typename TScopeExitLambda >
details::scope_exit_caller< TScopeExitLambda > scope_exit (TScopeExitLambda &&lambda) noexcept
 
bool operator== (const simple_label &lhs, const simple_label &rhs)
 
bool operator!= (const simple_label &lhs, const simple_label &rhs)
 
VW::string_view to_string (VW::slates::example_type)
 
template<size_t num_cols>
void format_row (const std::array< std::string, num_cols > &contents, const std::array< column_definition, num_cols > &column_definitions, size_t column_padding, std::ostream &output)
 
template<size_t num_cols>
std::string format_row (const std::array< std::string, num_cols > &contents, const std::array< column_definition, num_cols > &column_definitions, size_t column_padding)
 
bool try_extract_random_seed (const VW::example &ex, VW::string_view &view)
 
std::string decode_inline_hex (VW::string_view arg, VW::io::logger &logger)
 Replace hex sequences in a string with their corresponding byte. A hex sequence must only contain two digits and must be in the form \x00. More...
 
std::string fmt_float (float f, int max_decimal_places)
 Format float to string with max number of digits after the decimal place. More...
 
void unique_features (features &fs, int max=-1)
 Remove all non unique features from a feature group. More...
 
void unique_sort_features (uint64_t parse_mask, VW::example &ae)
 
constexpr version_struct VERSION (VW_VERSION_MAJOR, VW_VERSION_MINOR, VW_VERSION_PATCH)
 
constexpr version_struct version (VW_VERSION_MAJOR, VW_VERSION_MINOR, VW_VERSION_PATCH)
 
VW::workspaceinitialize (std::unique_ptr< config::options_i, options_deleter_type > options, io_buf *model=nullptr, bool skip_model_load=false, trace_message_t trace_listener=nullptr, void *trace_context=nullptr)
 
VW::workspaceinitialize (config::options_i &options, io_buf *model=nullptr, bool skip_model_load=false, trace_message_t trace_listener=nullptr, void *trace_context=nullptr)
 
VW::workspaceinitialize (const std::string &s, io_buf *model=nullptr, bool skip_model_load=false, trace_message_t trace_listener=nullptr, void *trace_context=nullptr)
 
VW::workspaceinitialize (int argc, char *argv[], io_buf *model=nullptr, bool skip_model_load=false, trace_message_t trace_listener=nullptr, void *trace_context=nullptr)
 
VW::workspaceseed_vw_model (VW::workspace *vw_model, const std::string &extra_args, trace_message_t trace_listener=nullptr, void *trace_context=nullptr)
 
VW::workspaceinitialize_escaped (std::string const &s, io_buf *model=nullptr, bool skip_model_load=false, trace_message_t trace_listener=nullptr, void *trace_context=nullptr)
 
VW::workspaceinitialize_with_builder (const std::string &s, io_buf *model=nullptr, bool skip_model_load=false, trace_message_t trace_listener=nullptr, void *trace_context=nullptr, std::unique_ptr< VW::setup_base_i >=nullptr)
 
std::unique_ptr< VW::workspaceinitialize (std::unique_ptr< config::options_i > options, std::unique_ptr< VW::io::reader > model_override_reader=nullptr, driver_output_func_t driver_output_func=nullptr, void *driver_output_func_context=nullptr, VW::io::logger *custom_logger=nullptr)
 Initialize a workspace. More...
 
std::unique_ptr< VW::workspaceseed_vw_model (VW::workspace &vw_model, const std::vector< std::string > &extra_args, driver_output_func_t driver_output_func=nullptr, void *driver_output_func_context=nullptr, VW::io::logger *custom_logger=nullptr)
 
std::unique_ptr< VW::workspaceinitialize_experimental (std::unique_ptr< config::options_i > options, std::unique_ptr< VW::io::reader > model_override_reader=nullptr, driver_output_func_t driver_output_func=nullptr, void *driver_output_func_context=nullptr, VW::io::logger *custom_logger=nullptr, std::unique_ptr< VW::setup_base_i > setup_base=nullptr)
 Initialize a workspace. This interface is currently experimental, but will replace the existing array of initialize functions. More...
 
void cmd_string_replace_value (std::stringstream *&ss, std::string flag_to_replace, const std::string &new_value)
 
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 (const VW::workspace &vw1, const VW::workspace &vw2)
 
void finish (VW::workspace &all, bool delete_all=true)
 Call finish() after you are done with the vw instance. This cleans up memory usage if delete_all is true. Finish will cause final stat printouts and model serialization to occur. IMPORTANT: If lifetime is managed by a unique_ptr from initialize_experimental, then you must call this with delete_all = false. More...
 
void sync_stats (VW::workspace &all)
 
void start_parser (VW::workspace &all)
 
void end_parser (VW::workspace &all)
 
bool is_ring_example (const VW::workspace &all, const example *ae)
 
exampleread_example (VW::workspace &all, const char *example_line)
 
exampleread_example (VW::workspace &all, const std::string &example_line)
 
exampleimport_example (VW::workspace &all, const std::string &label, primitive_feature_space *features, size_t len)
 
examplealloc_examples (size_t count)
 
void dealloc_examples (example *example_ptr, size_t count)
 
void parse_example_label (VW::workspace &all, example &ec, const std::string &label)
 
examplenew_unused_example (VW::workspace &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::workspace &all, example *ec, size_t &feature_number)
 
void return_features (feature *f)
 
void add_constant_feature (const VW::workspace &all, example *ec)
 
void add_label (example *ec, float label, float weight=1, float base=0)
 
void finish_example (VW::workspace &all, example &ec)
 
void finish_example (VW::workspace &all, multi_ex &ec)
 
void empty_example (VW::workspace &all, example &ec)
 
void move_feature_namespace (example *dst, example *src, namespace_index c)
 
void copy_example_metadata (example *, const example *)
 
void copy_example_data_with_label (example *dst, const example *src)
 
primitive_feature_spaceexport_example (VW::workspace &all, example *e, size_t &len)
 
void release_feature_space (primitive_feature_space *features, size_t len)
 
void releaseFeatureSpace (primitive_feature_space *features, size_t len)
 
void save_predictor (VW::workspace &all, const std::string &reg_name)
 
void save_predictor (VW::workspace &all, io_buf &buf)
 
uint64_t hash_space (VW::workspace &all, const std::string &s)
 
uint64_t hash_space_static (const std::string &s, const std::string &hash)
 
uint64_t hash_space_cstr (VW::workspace &all, const char *fstr)
 
uint64_t hash_feature (VW::workspace &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::workspace &all, const char *fstr, uint64_t u)
 
uint64_t chain_hash (VW::workspace &all, const std::string &name, const std::string &value, uint64_t u)
 
uint64_t chain_hash_static (const std::string &name, const std::string &value, uint64_t u, hash_func_t hash_func, uint64_t parse_mask)
 
float get_weight (VW::workspace &all, uint32_t index, uint32_t offset)
 
void set_weight (VW::workspace &all, uint32_t index, uint32_t offset, float value)
 
uint32_t num_weights (VW::workspace &all)
 
uint32_t get_stride (VW::workspace &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)
 
void validate_version (VW::workspace &all)
 
void validate_min_max_label (VW::workspace &all)
 
void validate_default_bits (VW::workspace &all, uint32_t local_num_bits)
 
void validate_num_bits (VW::workspace &all)
 

Variables

VW::label_parser cb_label_parser_global
 
VW::label_parser cb_eval_label_parser_global
 
VW::label_parser cb_with_observations_global
 
VW::label_parser ccb_label_parser_global
 
constexpr size_t NUM_NAMESPACES = 256
 
VW::label_parser cs_label_parser_global
 
VW::label_parser multiclass_label_parser_global
 
VW::label_parser multilabel_label_parser_global
 
VW::label_parser no_label_parser_global
 
VW::label_parser simple_label_parser_global
 
const std::string GIT_COMMIT
 
const std::string git_commit
 
const std::string ENABLED_FEATURES
 

Typedef Documentation

◆ action_scores

◆ decision_scores_t

using VW::decision_scores_t = typedef std::vector<VW::action_scores>

◆ driver_output_func_t

◆ example_factory_t

using VW::example_factory_t = typedef std::function<example&()>

◆ example_sink_f

using VW::example_sink_f = typedef std::function<void(VW::multi_ex&& spare_examples)>

◆ extent_term

using VW::extent_term = typedef std::pair<namespace_index, uint64_t>

◆ feature_index

using VW::feature_index = typedef uint64_t

◆ feature_value

using VW::feature_value = typedef float

◆ generate_func_t

template<typename T >
using VW::generate_func_t = typedef std::vector<std::vector<T> >(const std::set<T>& namespaces, size_t num_to_pick)

◆ hash_func_t

using VW::hash_func_t = typedef uint32_t (*)(const char*, size_t, uint32_t)

◆ learner_cleanup_example_func

template<typename DataT , typename ExampleT >
using VW::learner_cleanup_example_func = typedef void(DataT&, ExampleT&)

◆ learner_output_example_prediction_func

template<typename DataT , typename ExampleT >
using VW::learner_output_example_prediction_func = typedef void( VW::workspace& all, const DataT&, const ExampleT&, VW::io::logger& logger)

◆ learner_print_update_func

template<typename DataT , typename ExampleT >
using VW::learner_print_update_func = typedef void( VW::workspace& all, shared_data&, const DataT&, const ExampleT&, VW::io::logger& logger)

◆ learner_update_stats_func

template<typename DataT , typename ExampleT >
using VW::learner_update_stats_func = typedef void( const VW::workspace& all, shared_data& sd, const DataT&, const ExampleT&, VW::io::logger& logger)

◆ multi_ex

typedef std::vector< VW::example * > VW::multi_ex

◆ namespace_index

typedef unsigned char VW::namespace_index

◆ no_lock_object_pool

template<typename T , typename TInitializer = details::default_factory<T>>
using VW::no_lock_object_pool = typedef details::object_pool_impl<T, details::null_mutex, TInitializer>

◆ object_pool

template<typename T , typename TInitializer = details::default_factory<T>>
using VW::object_pool = typedef details::object_pool_impl<T, std::mutex, TInitializer>

◆ options_deleter_type

using VW::options_deleter_type = typedef void (*)(VW::config::options_i*)

◆ reduction_setup_fn

using VW::reduction_setup_fn = typedef std::shared_ptr<VW::LEARNER::learner> (*)(VW::setup_base_i&)

◆ SpanningTree

◆ string_view

using VW::string_view = typedef nonstd::string_view

◆ trace_message_t

using VW::trace_message_t = typedef void (*)(void*, const std::string&)

◆ v_array_pool

template<typename T >
using VW::v_array_pool = typedef VW::moved_object_pool<v_array<T> >

◆ vector_pool

template<typename T >
using VW::vector_pool = typedef VW::moved_object_pool<std::vector<T> >

◆ weight

using VW::weight = typedef float

Enumeration Type Documentation

◆ align_type

enum class VW::align_type
strong
Enumerator
left 
right 

◆ all_reduce_type

enum class VW::all_reduce_type
strong
Enumerator
SOCKET 
THREAD 

◆ cb_type_t

enum class VW::cb_type_t : uint32_t
strong
Enumerator
DR 
DM 
IPS 
MTR 
SM 

◆ ccb_example_type

enum class VW::ccb_example_type : uint8_t
strong
Enumerator
UNSET 
SHARED 
ACTION 
SLOT 

◆ label_type_t

enum class VW::label_type_t : uint32_t
strong
Enumerator
SIMPLE 
CB 
CB_EVAL 
CB_WITH_OBSERVATIONS 
CS 
MULTILABEL 
MULTICLASS 
CCB 
SLATES 
NOLABEL 
CONTINUOUS 
simple 
Deprecated:
"VW::label_type_t::simple has been renamed to VW::label_type_t::SIMPLE"
cb 
Deprecated:
"VW::label_type_t::cb has been renamed to VW::label_type_t::CB"
cb_eval 
Deprecated:
"VW::label_type_t::cb_eval has been renamed to VW::label_type_t::CB_EVAL"
cs 
Deprecated:
"VW::label_type_t::cs has been renamed to VW::label_type_t::CS"
multilabel 
Deprecated:
"VW::label_type_t::multilabel has been renamed to VW::label_type_t::MULTILABEL"
multiclass 
Deprecated:
"VW::label_type_t::multiclass has been renamed to VW::label_type_t::MULTICLASS"
ccb 
Deprecated:
"VW::label_type_t::ccb has been renamed to VW::label_type_t::CCB"
slates 
Deprecated:
"VW::label_type_t::slates has been renamed to VW::label_type_t::SLATES"
nolabel 
Deprecated:
"VW::label_type_t::nolabel has been renamed to VW::label_type_t::NOLABEL"
continuous 
Deprecated:
"VW::label_type_t::continuous has been renamed to VW::label_type_t::CONTINUOUS"

◆ prediction_type_t

enum class VW::prediction_type_t : uint32_t
strong
Enumerator
SCALAR 
SCALARS 
ACTION_SCORES 
PDF 
ACTION_PROBS 
MULTICLASS 
MULTILABELS 
PROB 
MULTICLASS_PROBS 
DECISION_PROBS 
ACTION_PDF_VALUE 
ACTIVE_MULTICLASS 
NOPRED 
scalar 
Deprecated:
"VW::prediction_type_t::scalar has been renamed to VW::prediction_type_t::SCALAR"
scalars 
Deprecated:
"VW::prediction_type_t::scalars has been renamed to VW::prediction_type_t::SCALARS"
action_scores 
Deprecated:
"VW::prediction_type_t::action_scores has been renamed to VW::prediction_type_t::ACTION_SCORES"
pdf 
Deprecated:
"VW::prediction_type_t::pdf has been renamed to VW::prediction_type_t::PDF"
action_probs 
Deprecated:
"VW::prediction_type_t::action_probs has been renamed to VW::prediction_type_t::ACTION_PROBS"
multiclass 
Deprecated:
"VW::prediction_type_t::multiclass has been renamed to VW::prediction_type_t::MULTICLASS"
multilabels 
Deprecated:
"VW::prediction_type_t::multilabels has been renamed to VW::prediction_type_t::MULTILABELS"
prob 
Deprecated:
"VW::prediction_type_t::prob has been renamed to VW::prediction_type_t::PROB"
multiclassprobs 
Deprecated:
"VW::prediction_type_t::multiclassprobs has been renamed to VW::prediction_type_t::MULTICLASS_PROBS"
decision_probs 
Deprecated:
"VW::prediction_type_t::decision_probs has been renamed to VW::prediction_type_t::DECISION_PROBS"
action_pdf_value 
Deprecated:
"VW::prediction_type_t::action_pdf_value has been renamed to VW::prediction_type_t::ACTION_PDF_VALUE"
active_multiclass 
Deprecated:
"VW::prediction_type_t::active_multiclass has been renamed to VW::prediction_type_t::ACTIVE_MULTICLASS"
nopred 
Deprecated:
"VW::prediction_type_t::nopred has been renamed to VW::prediction_type_t::NOPRED"

◆ wrap_type

enum class VW::wrap_type
strong
Enumerator
truncate 
truncate_with_ellipsis 
wrap_space 
wrap_char 

Function Documentation

◆ add_constant_feature()

void VW::add_constant_feature ( const VW::workspace all,
example ec 
)

◆ add_label()

void VW::add_label ( example ec,
float  label,
float  weight = 1,
float  base = 0 
)

◆ alloc_examples()

example * VW::alloc_examples ( size_t  count)
Deprecated:
"This function is no longer needed and will be removed. Use new/make_unique/make_shared or stack based as " "appropriate."

◆ are_features_compatible()

const char * VW::are_features_compatible ( const VW::workspace vw1,
const VW::workspace vw2 
)

◆ begin_scores()

action_scores_score_iterator VW::begin_scores ( action_scores a_s)
inline

◆ cast_signed_to_unsigned()

template<typename RetType , typename InputType >
RetType VW::cast_signed_to_unsigned ( InputType  input)

◆ cast_to_smaller_type()

template<typename RetType , typename InputType >
RetType VW::cast_to_smaller_type ( InputType  input)

◆ cast_unsigned_to_signed()

template<typename RetType , typename InputType >
RetType VW::cast_unsigned_to_signed ( InputType  input)

◆ cb_type_from_string()

cb_type_t VW::cb_type_from_string ( string_view  str)

◆ chain_hash()

uint64_t VW::chain_hash ( VW::workspace all,
const std::string &  name,
const std::string &  value,
uint64_t  u 
)
inline

◆ chain_hash_static()

uint64_t VW::chain_hash_static ( const std::string &  name,
const std::string &  value,
uint64_t  u,
hash_func_t  hash_func,
uint64_t  parse_mask 
)
inline

◆ cmd_string_replace_value()

void VW::cmd_string_replace_value ( std::stringstream *&  ss,
std::string  flag_to_replace,
const std::string &  new_value 
)
Deprecated:
"VW no longer supports manipulating a command line with cmd_string_replace_value. This function will be removed in " "VW 10."

◆ contains_wildcard() [1/2]

bool VW::contains_wildcard ( const std::vector< VW::extent_term > &  interaction)
inline

◆ contains_wildcard() [2/2]

bool VW::contains_wildcard ( const std::vector< VW::namespace_index > &  interaction)
inline

◆ copy_example_data()

void VW::copy_example_data ( example dst,
const example src 
)

◆ copy_example_data_with_label()

void VW::copy_example_data_with_label ( example dst,
const example src 
)

◆ copy_example_metadata()

void VW::copy_example_metadata ( example ,
const example  
)

◆ count_label()

void VW::count_label ( shared_data sd,
float  l 
)
inline

◆ dealloc_examples()

void VW::dealloc_examples ( example example_ptr,
size_t  count 
)
Deprecated:
"This function is no longer needed and will be removed."

◆ decode_inline_hex()

std::string VW::decode_inline_hex ( VW::string_view  arg,
VW::io::logger logger 
)

Replace hex sequences in a string with their corresponding byte. A hex sequence must only contain two digits and must be in the form \x00.

Parameters
argString to replace hex values within
Returns
A copy of the original string with hex values replaced with corresponding byte.

◆ ec_is_example_header_cb()

bool VW::ec_is_example_header_cb ( VW::example const &  ec)

◆ ec_is_example_header_cb_with_observations()

bool VW::ec_is_example_header_cb_with_observations ( VW::example const &  ec)

◆ empty_example()

void VW::empty_example ( VW::workspace all,
example ec 
)

◆ end_parser()

void VW::end_parser ( VW::workspace all)

◆ end_scores()

action_scores_score_iterator VW::end_scores ( action_scores a_s)
inline

◆ ends_with()

bool VW::ends_with ( VW::string_view  full_string,
VW::string_view  ending 
)
inline

Check if a string ends with some other string.

Parameters
full_stringString to check ending of
endingEnding value to check
Returns
true if full_string ends with ending, otherwise false.

◆ eval_sum_ft_squared_of_generated_ft()

float VW::eval_sum_ft_squared_of_generated_ft ( bool  permutations,
const std::vector< std::vector< VW::namespace_index > > &  interactions,
const std::vector< std::vector< VW::extent_term > > &  extent_interactions,
const std::array< VW::features, VW::NUM_NAMESPACES > &  feature_spaces 
)

◆ example_is_newline()

bool VW::example_is_newline ( const example ec)
inline

◆ example_is_newline_not_header_cb()

bool VW::example_is_newline_not_header_cb ( VW::example const &  ec)
inline

◆ export_example()

primitive_feature_space * VW::export_example ( VW::workspace all,
example e,
size_t &  len 
)

◆ fast_pow10()

VW_STD14_CONSTEXPR float VW::fast_pow10 ( int8_t  exponent)
inline

◆ features_dot_product()

float VW::features_dot_product ( const features fs1,
const features fs2 
)

Both fs1 and fs2 must be sorted. Most often used with VW::flatten_features

◆ file_open()

int VW::file_open ( FILE **  pf,
const char *  filename,
const char *  mode 
)

◆ finish()

void VW::finish ( VW::workspace all,
bool  delete_all = true 
)

Call finish() after you are done with the vw instance. This cleans up memory usage if delete_all is true. Finish will cause final stat printouts and model serialization to occur. IMPORTANT: If lifetime is managed by a unique_ptr from initialize_experimental, then you must call this with delete_all = false.

Parameters
allworkspace to be finished
delete_allwhethere to also also call delete on this instance.
Deprecated:
"If needing to cleanup memory, rely on the workspace destructor. Driver finalization is now handled by " "VW::workspace::finish()."

◆ finish_example() [1/2]

void VW::finish_example ( VW::workspace all,
example ec 
)

◆ finish_example() [2/2]

void VW::finish_example ( VW::workspace all,
multi_ex ec 
)

◆ flatten_features()

void VW::flatten_features ( VW::workspace all,
example ec,
features fs 
)

◆ fmt_float()

std::string VW::fmt_float ( float  f,
int  max_decimal_places 
)

Format float to string with max number of digits after the decimal place.

Parameters
ffloat to format
max_decimal_placesif >=0 the max number of digits after decimal place. If <0, then as many digits are needed to represent the number will be used
Returns
std::string formatted float

◆ foreach_feature() [1/8]

template<class DataT , void(*)(DataT &, float, float) FuncT, class WeightsT >
void VW::foreach_feature ( const WeightsT &  weights,
const VW::features fs,
DataT &  dat,
uint64_t  offset = 0,
float  mult = 1. 
)
inline

◆ foreach_feature() [2/8]

template<class DataT , class WeightOrIndexT , void(*)(DataT &, float, WeightOrIndexT) FuncT>
void VW::foreach_feature ( VW::workspace all,
VW::example ec,
DataT &  dat 
)
inline

◆ foreach_feature() [3/8]

template<class DataT , void(*)(DataT &, float, float &) FuncT>
void VW::foreach_feature ( VW::workspace all,
VW::example ec,
DataT &  dat 
)
inline

◆ foreach_feature() [4/8]

template<class DataT , class WeightOrIndexT , void(*)(DataT &, float, WeightOrIndexT) FuncT>
void VW::foreach_feature ( VW::workspace all,
VW::example ec,
DataT &  dat,
size_t &  num_interacted_features 
)
inline

◆ foreach_feature() [5/8]

template<class DataT , void(*)(DataT &, float, float &) FuncT>
void VW::foreach_feature ( VW::workspace all,
VW::example ec,
DataT &  dat,
size_t &  num_interacted_features 
)
inline

◆ foreach_feature() [6/8]

template<class DataT , void(*)(DataT &, float feature_value, uint64_t feature_index) FuncT, class WeightsT >
void VW::foreach_feature ( WeightsT &  weights,
const VW::features fs,
DataT &  dat,
uint64_t  offset = 0,
float  mult = 1. 
)
inline

◆ foreach_feature() [7/8]

template<class DataT , class WeightOrIndexT , void(*)(DataT &, float, WeightOrIndexT) FuncT, class WeightsT >
void VW::foreach_feature ( WeightsT &  weights,
bool  ignore_some_linear,
std::array< bool, VW::NUM_NAMESPACES > &  ignore_linear,
const std::vector< std::vector< VW::namespace_index > > &  interactions,
const std::vector< std::vector< VW::extent_term > > &  extent_interactions,
bool  permutations,
VW::example_predict ec,
DataT &  dat,
size_t &  num_interacted_features,
VW::details::generate_interactions_object_cache cache 
)
inline

◆ foreach_feature() [8/8]

template<class DataT , class WeightOrIndexT , void(*)(DataT &, float, WeightOrIndexT) FuncT, class WeightsT >
void VW::foreach_feature ( WeightsT &  weights,
bool  ignore_some_linear,
std::array< bool, VW::NUM_NAMESPACES > &  ignore_linear,
const std::vector< std::vector< VW::namespace_index > > &  interactions,
const std::vector< std::vector< VW::extent_term > > &  extent_interactions,
bool  permutations,
VW::example_predict ec,
DataT &  dat,
VW::details::generate_interactions_object_cache cache 
)
inline

◆ format_row() [1/2]

template<size_t num_cols>
std::string VW::format_row ( const std::array< std::string, num_cols > &  contents,
const std::array< column_definition, num_cols > &  column_definitions,
size_t  column_padding 
)

◆ format_row() [2/2]

template<size_t num_cols>
void VW::format_row ( const std::array< std::string, num_cols > &  contents,
const std::array< column_definition, num_cols > &  column_definitions,
size_t  column_padding,
std::ostream &  output 
)

◆ free_args()

void VW::free_args ( int  argc,
char *  argv[] 
)
Deprecated:
"This function will be removed in VW 10."

◆ generate_interactions() [1/4]

template<class DataT , class WeightOrIndexT , void(*)(DataT &, float, WeightOrIndexT) FuncT, bool audit, void(*)(DataT &, const VW::audit_strings *) audit_func, class WeightsT >
void VW::generate_interactions ( const std::vector< std::vector< VW::namespace_index > > &  interactions,
const std::vector< std::vector< VW::extent_term > > &  extent_interactions,
bool  permutations,
VW::example_predict ec,
DataT &  dat,
WeightsT &  weights,
size_t &  num_features,
VW::details::generate_interactions_object_cache cache 
)
inline

◆ generate_interactions() [2/4]

template<class DataT , class WeightOrIndexT , void(*)(DataT &, float, WeightOrIndexT) FuncT, class WeightsT >
void VW::generate_interactions ( const std::vector< std::vector< VW::namespace_index > > &  interactions,
const std::vector< std::vector< VW::extent_term > > &  extent_interactions,
bool  permutations,
VW::example_predict ec,
DataT &  dat,
WeightsT &  weights,
size_t &  num_interacted_features,
VW::details::generate_interactions_object_cache cache 
)
inline

◆ generate_interactions() [3/4]

template<class R , class S , void(*)(R &, float, S) T, bool audit, void(*)(R &, const VW::audit_strings *) audit_func>
void VW::generate_interactions ( VW::workspace all,
VW::example_predict ec,
R &  dat,
size_t &  num_interacted_features 
)
inline

◆ generate_interactions() [4/4]

template<class R , class S , void(*)(R &, float, S) T>
void VW::generate_interactions ( VW::workspace all,
VW::example_predict ec,
R &  dat,
size_t &  num_interacted_features 
)
inline

◆ get_action_score()

float VW::get_action_score ( example ec,
size_t  i 
)

◆ get_action_score_length()

size_t VW::get_action_score_length ( example ec)

◆ get_best_constant()

bool VW::get_best_constant ( const loss_function loss_func,
const shared_data sd,
float &  best_constant,
float &  best_constant_loss 
)

◆ get_confidence()

float VW::get_confidence ( example ec)

◆ get_cost_estimate() [1/4]

float VW::get_cost_estimate ( const VW::action_score a_s,
float  cost,
uint32_t  action,
float  offset = 0. 
)
inline

◆ get_cost_estimate() [2/4]

float VW::get_cost_estimate ( const VW::cb_class observation,
const VW::cs_label scores,
uint32_t  action 
)
inline

◆ get_cost_estimate() [3/4]

float VW::get_cost_estimate ( const VW::cb_class observation,
uint32_t  action,
float  offset = 0. 
)
inline

◆ get_cost_estimate() [4/4]

float VW::get_cost_estimate ( const VW::cb_label ld,
uint32_t  action 
)
inline

◆ get_cost_pred()

template<bool is_learn>
float VW::get_cost_pred ( VW::LEARNER::learner scorer,
const VW::cb_class known_cost,
VW::example ec,
uint32_t  index,
uint32_t  base 
)

◆ get_cost_sensitive_prediction()

float VW::get_cost_sensitive_prediction ( example ec)

◆ get_cost_sensitive_prediction_confidence_scores()

v_array< float > & VW::get_cost_sensitive_prediction_confidence_scores ( example ec)

◆ get_example()

example * VW::get_example ( parser pf)

◆ get_feature_number()

size_t VW::get_feature_number ( example ec)

◆ get_features()

feature * VW::get_features ( VW::workspace all,
example ec,
size_t &  feature_number 
)

◆ get_hasher()

hash_func_t VW::get_hasher ( const std::string &  s)

◆ get_importance()

float VW::get_importance ( example ec)

◆ get_initial()

float VW::get_initial ( example ec)

◆ get_label()

float VW::get_label ( example ec)

◆ get_label_parser()

label_parser VW::get_label_parser ( VW::label_type_t  label_type)

◆ get_loss_function()

std::unique_ptr< loss_function > VW::get_loss_function ( VW::workspace ,
const std::string &  funcName,
float  function_parameter_0 = -1.0f,
float  function_parameter_1 = 1.0f 
)

◆ get_multilabel_predictions()

uint32_t * VW::get_multilabel_predictions ( example ec,
size_t &  len 
)

◆ get_observed_cost_cb()

std::pair< bool, cb_class > VW::get_observed_cost_cb ( const cb_label ld)

◆ get_observed_cost_or_default_cb_adf()

VW::cb_class VW::get_observed_cost_or_default_cb_adf ( const VW::multi_ex examples)

◆ get_pid()

int VW::get_pid ( )

◆ get_prediction()

float VW::get_prediction ( example ec)

◆ get_stride()

uint32_t VW::get_stride ( VW::workspace all)
inline

◆ get_tag()

const char * VW::get_tag ( example ec)

◆ get_tag_length()

size_t VW::get_tag_length ( example ec)

◆ get_topic_prediction()

float VW::get_topic_prediction ( example ec,
size_t  i 
)

◆ get_unused_example()

VW::example & VW::get_unused_example ( VW::workspace all)

◆ get_weight()

float VW::get_weight ( VW::workspace all,
uint32_t  index,
uint32_t  offset 
)
inline

◆ hash_feature()

uint64_t VW::hash_feature ( VW::workspace all,
const std::string &  s,
uint64_t  u 
)
inline

◆ hash_feature_cstr()

uint64_t VW::hash_feature_cstr ( VW::workspace all,
const char *  fstr,
uint64_t  u 
)
inline

◆ hash_feature_static()

uint64_t VW::hash_feature_static ( const std::string &  s,
uint64_t  u,
const std::string &  h,
uint32_t  num_bits 
)
inline

◆ hash_space()

uint64_t VW::hash_space ( VW::workspace all,
const std::string &  s 
)
inline

◆ hash_space_cstr()

uint64_t VW::hash_space_cstr ( VW::workspace all,
const char *  fstr 
)
inline

◆ hash_space_static()

uint64_t VW::hash_space_static ( const std::string &  s,
const std::string &  hash 
)
inline

◆ import_example()

example * VW::import_example ( VW::workspace all,
const std::string &  label,
primitive_feature_space features,
size_t  len 
)

◆ init_features()

void VW::init_features ( primitive_feature_space fs,
size_t  features_count 
)
inline

◆ initialize() [1/5]

VW::workspace * VW::initialize ( config::options_i options,
io_buf model = nullptr,
bool  skip_model_load = false,
trace_message_t  trace_listener = nullptr,
void *  trace_context = nullptr 
)
Deprecated:
"Replaced with new unique_ptr based overload."

◆ initialize() [2/5]

VW::workspace * VW::initialize ( const std::string &  s,
io_buf model = nullptr,
bool  skip_model_load = false,
trace_message_t  trace_listener = nullptr,
void *  trace_context = nullptr 
)
Deprecated:
"Replaced with new unique_ptr based overload."

◆ initialize() [3/5]

VW::workspace * VW::initialize ( int  argc,
char *  argv[],
io_buf model = nullptr,
bool  skip_model_load = false,
trace_message_t  trace_listener = nullptr,
void *  trace_context = nullptr 
)
Deprecated:
"Replaced with new unique_ptr based overload."

◆ initialize() [4/5]

std::unique_ptr< VW::workspace > VW::initialize ( std::unique_ptr< config::options_i options,
std::unique_ptr< VW::io::reader model_override_reader = nullptr,
driver_output_func_t  driver_output_func = nullptr,
void *  driver_output_func_context = nullptr,
VW::io::logger custom_logger = nullptr 
)

Initialize a workspace.

Examples

To intialize a workspace with specific arguments.

auto vw = VW::initialize(VW::make_unique<VW::config::options_cli>(
std::vector<std::string>{"--cb_explore_adf", "--epsilon=0.1", "--quadratic=::"}));
Definition: global_data.h:293
VW::workspace * initialize(std::unique_ptr< config::options_i, options_deleter_type > options, io_buf *model=nullptr, bool skip_model_load=false, trace_message_t trace_listener=nullptr, void *trace_context=nullptr)

To initialize a workspace with a string that needs to be split. VW::split_command_line() can be used to split the string similar to how a shell would

auto all = VW::initialize(VW::make_unique<VW::config::options_cli>(
VW::split_command_line("--cb_explore_adf --epsilon=0.1 --quadratic=::")));
std::vector< std::string > split_command_line(const std::string &cmd_line)
Split a string like a shell splits a command line. This function handles quotes and escapes.

Note: You used to need to call VW::finish() to free the workspace. This is no longer needed and the destructor will free the workspace. However, VW::finish() would also do driver finalization steps, such as writing the output model. This is not often needed in library mode but can be run using VW::workspace::finish().

Parameters
optionsThe options to initialize the workspace with. Usually an instance of VW::config::options_cli.
model_override_readeroptional reading source to read the model from. Will override any model specified on the command line.
driver_output_funcoptional function to forward driver ouput to
driver_output_func_contextcontext for driver_output_func
custom_loggeroptional custom logger object to override with
setup_baseoptional advanced override of reduction stack
Returns
std::unique_ptr<VW::workspace> initialized workspace

◆ initialize() [5/5]

VW::workspace * VW::initialize ( std::unique_ptr< config::options_i, options_deleter_type options,
io_buf model = nullptr,
bool  skip_model_load = false,
trace_message_t  trace_listener = nullptr,
void *  trace_context = nullptr 
)
Deprecated:
"Replaced with new unique_ptr based overload."

◆ initialize_escaped()

VW::workspace * VW::initialize_escaped ( std::string const &  s,
io_buf model = nullptr,
bool  skip_model_load = false,
trace_message_t  trace_listener = nullptr,
void *  trace_context = nullptr 
)
Deprecated:
"Replaced with new unique_ptr based overload."

◆ initialize_experimental()

std::unique_ptr< VW::workspace > VW::initialize_experimental ( std::unique_ptr< config::options_i options,
std::unique_ptr< VW::io::reader model_override_reader = nullptr,
driver_output_func_t  driver_output_func = nullptr,
void *  driver_output_func_context = nullptr,
VW::io::logger custom_logger = nullptr,
std::unique_ptr< VW::setup_base_i setup_base = nullptr 
)

Initialize a workspace. This interface is currently experimental, but will replace the existing array of initialize functions.

Parameters
optionsThe options to initialize the workspace with. Usually an instance of VW::config::options_cli.
model_override_readeroptional reading source to read the model from. Will override any model specified on the command line.
driver_output_funcoptional function to forward driver ouput to
driver_output_func_contextcontext for driver_output_func
custom_loggeroptional custom logger object to override with
setup_baseoptional advanced override of reduction stack
Returns
std::unique_ptr<VW::workspace> initialized workspace

◆ initialize_with_builder()

VW::workspace * VW::initialize_with_builder ( const std::string &  s,
io_buf model = nullptr,
bool  skip_model_load = false,
trace_message_t  trace_listener = nullptr,
void *  trace_context = nullptr,
std::unique_ptr< VW::setup_base_i = nullptr 
)
Deprecated:
"For scenarios requiring the builder, initialize_experimental should be used."

◆ inline_predict() [1/4]

float VW::inline_predict ( VW::workspace all,
VW::example ec 
)
inline

◆ inline_predict() [2/4]

float VW::inline_predict ( VW::workspace all,
VW::example ec,
size_t &  num_generated_features 
)
inline

◆ inline_predict() [3/4]

template<class WeightsT >
float VW::inline_predict ( WeightsT &  weights,
bool  ignore_some_linear,
std::array< bool, VW::NUM_NAMESPACES > &  ignore_linear,
const std::vector< std::vector< VW::namespace_index > > &  interactions,
const std::vector< std::vector< VW::extent_term > > &  extent_interactions,
bool  permutations,
VW::example_predict ec,
size_t &  num_interacted_features,
VW::details::generate_interactions_object_cache cache,
float  initial = 0.f 
)
inline

◆ inline_predict() [4/4]

template<class WeightsT >
float VW::inline_predict ( WeightsT &  weights,
bool  ignore_some_linear,
std::array< bool, VW::NUM_NAMESPACES > &  ignore_linear,
const std::vector< std::vector< VW::namespace_index > > &  interactions,
const std::vector< std::vector< VW::extent_term > > &  extent_interactions,
bool  permutations,
VW::example_predict ec,
VW::details::generate_interactions_object_cache cache,
float  initial = 0.f 
)
inline

◆ is_cs_example_header()

bool VW::is_cs_example_header ( const VW::example ec)

◆ is_interaction_ns()

constexpr bool VW::is_interaction_ns ( const unsigned char  ns)
inlineconstexpr

◆ is_ring_example()

bool VW::is_ring_example ( const VW::workspace all,
const example ae 
)
Deprecated:
"It is no longer supported to query whether an example is a ring example. This function will be removed in VW 10"

◆ make_unique()

template<typename T , typename... Args>
std::unique_ptr< T > VW::make_unique ( Args &&...  params)

◆ merge_deltas()

VW::model_delta VW::merge_deltas ( const std::vector< const VW::model_delta * > &  deltas_to_merge,
VW::io::logger logger = nullptr 
)

Merge several model deltas into a single delta. This merges weights and all training state. All given deltas must be from compatible models, meaning they should have the same reduction stack and same training based options. All deltas are assumed to be generated using a single shared base workspace.

Note: This is an experimental API.

Parameters
deltas_to_mergeVector of model deltas to merge.
loggerOptional logger to be used for logging during function and is given to the resulting workspace
Returns
std::unique_ptr<VW::workspace> Pointer to the resulting workspace.

◆ merge_models()

std::unique_ptr< VW::workspace > VW::merge_models ( const VW::workspace base_workspace,
const std::vector< const VW::workspace * > &  workspaces_to_merge,
VW::io::logger logger = nullptr 
)

Merge the differences of several workspaces into the given base workspace. This merges weights and all training state. All given workspaces must be compatible with the base workspace, meaning they should have the same reduction stack and same training based options.

If the base workspace was not given, it is assumed that the given workspaces were trained from fresh.

Note: This is an experimental API.

Parameters
base_workspaceOptional common base model that all other models continued training from. If not supplied, then all models are assumed to be trained from scratch.
workspaces_to_mergeVector of workspaces to merge.
loggerOptional logger to be used for logging during function and is given to the resulting workspace
Returns
std::unique_ptr<VW::workspace> Pointer to the resulting workspace.

◆ move_feature_namespace()

void VW::move_feature_namespace ( example dst,
example src,
namespace_index  c 
)

◆ new_unused_example()

example * VW::new_unused_example ( VW::workspace all)

◆ num_weights()

uint32_t VW::num_weights ( VW::workspace all)
inline

◆ operator!=()

bool VW::operator!= ( const simple_label lhs,
const simple_label rhs 
)
inline

◆ operator+()

std::unique_ptr< VW::workspace > VW::operator+ ( const VW::workspace ws,
const VW::model_delta md 
)

◆ operator-()

VW::model_delta VW::operator- ( const VW::workspace ws1,
const VW::workspace ws2 
)

◆ operator<()

constexpr bool VW::operator< ( const action_score left,
const action_score right 
)
inlineconstexpr

◆ operator<<()

std::ostream & VW::operator<< ( std::ostream &  os,
const action_score a_s 
)

◆ operator==()

bool VW::operator== ( const simple_label lhs,
const simple_label rhs 
)
inline

◆ operator>()

constexpr bool VW::operator> ( const action_score left,
const action_score right 
)
inlineconstexpr

◆ parse_ccb_label()

void VW::parse_ccb_label ( ccb_label ld,
VW::label_parser_reuse_mem reuse_mem,
const std::vector< VW::string_view > &  words,
VW::io::logger logger 
)

◆ parse_example_label() [1/2]

void VW::parse_example_label ( string_view  label,
const VW::label_parser lbl_parser,
const named_labels ldict,
label_parser_reuse_mem reuse_mem,
example ec,
VW::io::logger logger 
)

◆ parse_example_label() [2/2]

void VW::parse_example_label ( VW::workspace all,
example ec,
const std::string &  label 
)

◆ print_decision_scores()

void VW::print_decision_scores ( VW::io::writer f,
const VW::decision_scores_t decision_scores,
VW::io::logger logger 
)

◆ print_update_ccb()

void VW::print_update_ccb ( VW::workspace all,
const std::vector< example * > &  slots,
const VW::decision_scores_t decision_scores,
size_t  num_features 
)

◆ print_update_slates()

void VW::print_update_slates ( VW::workspace all,
const std::vector< example * > &  slots,
const VW::decision_scores_t decision_scores,
size_t  num_features 
)

◆ read_example() [1/2]

example * VW::read_example ( VW::workspace all,
const char *  example_line 
)

◆ read_example() [2/2]

example * VW::read_example ( VW::workspace all,
const std::string &  example_line 
)

◆ read_example_from_cache()

int VW::read_example_from_cache ( VW::workspace all,
io_buf input,
VW::multi_ex examples 
)
inline
Deprecated:
"VW::read_example_from_cache moved to VW::parsers::cache::read_example_from_cache"

◆ read_line() [1/2]

void VW::read_line ( VW::workspace all,
example ex,
const char *  line 
)
inline
Deprecated:
"read_line moved to VW::parsers::text::read_line and should be used with a string_view"

◆ read_line() [2/2]

void VW::read_line ( VW::workspace all,
example ex,
VW::string_view  line 
)
inline
Deprecated:
"read_line moved to VW::parsers::text::read_line"

◆ read_line_decision_service_json()

template<bool audit>
bool VW::read_line_decision_service_json ( VW::workspace all,
VW::multi_ex examples,
char *  line,
size_t  length,
bool  copy_line,
example_factory_t  example_factory,
VW::parsers::json::decision_service_interaction data 
)
Deprecated:
"read_line_decision_service_json moved to VW::parsers::json::read_line_decision_service_json"

◆ read_line_json_s() [1/2]

template<bool audit>
template void VW::read_line_json_s< false > ( const VW::label_parser lbl_parser,
hash_func_t  hash_func,
uint64_t  hash_seed,
uint64_t  parse_mask,
bool  chain_hash,
VW::label_parser_reuse_mem reuse_mem,
const VW::named_labels ldict,
VW::multi_ex examples,
char *  line,
size_t  length,
example_factory_t  example_factory,
VW::io::logger logger,
std::unordered_map< std::string, std::set< std::string > > *  ignore_features,
const std::unordered_map< uint64_t, VW::example * > *  dedup_examples = nullptr 
)
Deprecated:
"read_line_json_s moved to VW::parsers::json::read_line_json"

◆ read_line_json_s() [2/2]

template<bool audit>
template void VW::read_line_json_s< false > ( VW::workspace all,
VW::multi_ex examples,
char *  line,
size_t  length,
example_factory_t  example_factory,
const std::unordered_map< uint64_t, VW::example * > *  dedup_examples = nullptr 
)
Deprecated:
"read_line_json_s moved to VW::parsers::json::read_line_json"

◆ read_lines() [1/2]

void VW::read_lines ( VW::workspace all,
const char *  line,
size_t  len,
VW::multi_ex examples 
)
inline
Deprecated:
"read_lines moved to VW::parsers::text::read_lines and should be used with a string_view"

◆ read_lines() [2/2]

void VW::read_lines ( VW::workspace all,
VW::string_view  lines,
VW::multi_ex examples 
)
inline
Deprecated:
"read_lines moved to VW::parsers::text::read_lines"

◆ reduction_features::get< VW::cb_explore_adf::greedy::reduction_features >() [1/2]

◆ reduction_features::get< VW::cb_explore_adf::greedy::reduction_features >() [2/2]

◆ reduction_features::get< VW::cb_graph_feedback::reduction_features >() [1/2]

◆ reduction_features::get< VW::cb_graph_feedback::reduction_features >() [2/2]

◆ reduction_features::get< VW::ccb_reduction_features >() [1/2]

◆ reduction_features::get< VW::ccb_reduction_features >() [2/2]

◆ reduction_features::get< VW::continuous_actions::reduction_features >() [1/2]

◆ reduction_features::get< VW::continuous_actions::reduction_features >() [2/2]

◆ reduction_features::get< VW::large_action_space::las_reduction_features >() [1/2]

◆ reduction_features::get< VW::large_action_space::las_reduction_features >() [2/2]

◆ reduction_features::get< VW::simple_label_reduction_features >() [1/2]

◆ reduction_features::get< VW::simple_label_reduction_features >() [2/2]

◆ release_feature_space()

void VW::release_feature_space ( primitive_feature_space features,
size_t  len 
)

◆ releaseFeatureSpace()

void VW::releaseFeatureSpace ( primitive_feature_space features,
size_t  len 
)
inline
Deprecated:
"VW::releaseFeatureSpace renamed to VW::release_feature_space"

◆ return_features()

void VW::return_features ( feature f)

◆ return_multiple_example()

void VW::return_multiple_example ( VW::workspace all,
VW::multi_ex examples 
)

◆ save_predictor() [1/2]

void VW::save_predictor ( VW::workspace all,
const std::string &  reg_name 
)

◆ save_predictor() [2/2]

void VW::save_predictor ( VW::workspace all,
io_buf buf 
)

◆ scope_exit()

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.
details::scope_exit_caller< TScopeExitLambda > scope_exit(TScopeExitLambda &&lambda) noexcept
Definition: scope_exit.h:68

◆ seed_vw_model() [1/2]

std::unique_ptr< VW::workspace > VW::seed_vw_model ( VW::workspace vw_model,
const std::vector< std::string > &  extra_args,
driver_output_func_t  driver_output_func = nullptr,
void *  driver_output_func_context = nullptr,
VW::io::logger custom_logger = nullptr 
)

Creates a workspace based off of another workspace. What this means is that the model weights and the shared_data object are shared. This function needs to be used with caution. Reduction data is not shared, therefore this function is unsafe to use for situations where reduction state is required for proper operation such as marginal and cb_adf. Learn on a seeded instance is unsafe, and prediction is also potentially unsafe.

◆ seed_vw_model() [2/2]

VW::workspace * VW::seed_vw_model ( VW::workspace vw_model,
const std::string &  extra_args,
trace_message_t  trace_listener = nullptr,
void *  trace_context = nullptr 
)
Deprecated:
"Replaced with new unique_ptr based overload."

◆ set_feature()

void VW::set_feature ( primitive_feature_space fs,
size_t  index,
uint64_t  feature_hash,
float  value 
)
inline

◆ set_weight()

void VW::set_weight ( VW::workspace all,
uint32_t  index,
uint32_t  offset,
float  value 
)
inline

◆ setup_example()

void VW::setup_example ( VW::workspace all,
example ae 
)

◆ setup_examples()

void VW::setup_examples ( VW::workspace all,
VW::multi_ex examples 
)

◆ split_by_limit()

std::vector< VW::string_view > VW::split_by_limit ( const VW::string_view s,
size_t  limit 
)

◆ split_command_line() [1/2]

std::vector< std::string > VW::split_command_line ( const std::string &  cmd_line)

Split a string like a shell splits a command line. This function handles quotes and escapes.

Parameters
cmd_lineThe command line to split
Returns
std::vector<std::string> A vector of strings representing the split command line

◆ split_command_line() [2/2]

std::vector< std::string > VW::split_command_line ( VW::string_view  cmd_line)

Split a string like a shell splits a command line. This function handles quotes and escapes.

Parameters
cmd_lineThe command line to split
Returns
std::vector<std::string> A vector of strings representing the split command line

◆ start_parser()

void VW::start_parser ( VW::workspace all)

◆ starts_with()

bool VW::starts_with ( VW::string_view  full_string,
VW::string_view  starting 
)
inline

Check if a string starts with some other string.

Parameters
full_stringString to check starting of
startingStarting value to check
Returns
true if full_string starts with starting, otherwise false.

◆ stash_guard()

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);
}
details::swap_guard_impl< T > swap_guard(T &original_location, T &value_to_swap) noexcept
Definition: guard.h:134

◆ string_cpy()

int VW::string_cpy ( char *  dest,
size_t  dest_size,
const char *  src 
)

◆ swap_guard() [1/2]

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);
}

◆ swap_guard() [2/2]

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);
}

◆ swap_prediction()

void VW::swap_prediction ( polyprediction a,
polyprediction b,
prediction_type_t  prediction_type 
)

◆ sync_stats()

void VW::sync_stats ( VW::workspace all)

◆ test_cb_adf_sequence()

VW::example * VW::test_cb_adf_sequence ( const VW::multi_ex ec_seq,
bool  allow_multiple_costs = false 
)

◆ test_multiclass_label()

bool VW::test_multiclass_label ( const multiclass_label ld)

◆ to_argv()

char ** VW::to_argv ( std::string const &  s,
int &  argc 
)
Deprecated:
"This functionality is now implemented by VW::split_command_line which supports escaping, etc. This function will " "be removed in VW 10."

◆ to_argv_escaped()

char ** VW::to_argv_escaped ( std::string const &  s,
int &  argc 
)
Deprecated:
"This functionality is now implemented by VW::split_command_line which supports escaping, etc. This function will " "be removed in VW 10."

◆ to_string() [1/19]

string_view VW::to_string ( cb_type_t  type)

◆ to_string() [2/19]

const char * VW::to_string ( ccb_example_type  type)

◆ to_string() [3/19]

std::string VW::to_string ( const action_scores action_scores_or_probs,
int  decimal_precision = details::DEFAULT_FLOAT_PRECISION 
)

◆ to_string() [4/19]

std::string VW::to_string ( const audit_strings ai)
inline

◆ to_string() [5/19]

std::string VW::to_string ( const cb_continuous::continuous_label lbl,
int  decimal_precision = details::DEFAULT_FLOAT_PRECISION 
)

◆ to_string() [6/19]

std::string VW::to_string ( const cb_continuous::continuous_label_elm elm,
int  decimal_precision = details::DEFAULT_FLOAT_PRECISION 
)

◆ to_string() [7/19]

std::string VW::to_string ( const continuous_actions::probability_density_function pdf,
int  decimal_precision = details::DEFAULT_FLOAT_PRECISION 
)

◆ to_string() [8/19]

std::string VW::to_string ( const continuous_actions::probability_density_function_value pdf_value,
int  decimal_precision = details::DEFAULT_FLOAT_PRECISION 
)

◆ to_string() [9/19]

std::string VW::to_string ( const v_array< float > &  scalars,
int  decimal_precision = details::DEFAULT_FLOAT_PRECISION 
)

◆ to_string() [10/19]

std::string VW::to_string ( const VW::active_multiclass_prediction active_multiclass)
inline

◆ to_string() [11/19]

std::string VW::to_string ( const VW::decision_scores_t decision_scores,
int  decimal_precision = VW::details::DEFAULT_FLOAT_PRECISION 
)

◆ to_string() [12/19]

std::string VW::to_string ( const VW::multilabel_label multilabels)

◆ to_string() [13/19]

std::string VW::to_string ( const VW::multilabel_prediction multilabels)

◆ to_string() [14/19]

string_view VW::to_string ( prediction_type_t  )

◆ to_string() [15/19]

◆ to_string() [16/19]

◆ to_string() [17/19]

◆ to_string() [18/19]

string_view VW::to_string ( VW::label_type_t  )

◆ to_string() [19/19]

◆ tokenize()

template<typename ContainerT >
void VW::tokenize ( char  delim,
VW::string_view  s,
ContainerT &  ret,
bool  allow_empty = false 
)

◆ trim_whitespace() [1/2]

std::string VW::trim_whitespace ( const std::string &  s)

Trim whitespace from the beginning and end of a string.

Parameters
sThe string to trim
Returns
std::string The trimmed string

◆ trim_whitespace() [2/2]

VW::string_view VW::trim_whitespace ( VW::string_view  str)

Trim whitespace from the beginning and end of a string.

Parameters
sThe string to trim
Returns
std::string The trimmed string

◆ trunc_weight()

float VW::trunc_weight ( const float  w,
const float  gravity 
)
inline

◆ try_extract_random_seed()

bool VW::try_extract_random_seed ( const VW::example ex,
VW::string_view view 
)

◆ uniform_hash()

VW_STD14_CONSTEXPR uint32_t VW::uniform_hash ( const char *  data,
size_t  len,
uint32_t  seed 
)
inline

◆ unique_features()

void VW::unique_features ( features fs,
int  max = -1 
)

Remove all non unique features from a feature group.

  • Uniqueness is determined by feature index.
  • This function requires the feature group to be sorted. For sorting see features::sort.
Parameters
fsFeature group to remove non-unique features from
maxThe maximum number of unique features to keep. -1 to keep all unique features.

◆ unique_sort_features()

void VW::unique_sort_features ( uint64_t  parse_mask,
VW::example ae 
)

◆ valid_ns()

bool VW::valid_ns ( char  c)
inline

◆ validate_default_bits()

void VW::validate_default_bits ( VW::workspace all,
uint32_t  local_num_bits 
)

◆ validate_min_max_label()

void VW::validate_min_max_label ( VW::workspace all)

◆ validate_num_bits()

void VW::validate_num_bits ( VW::workspace all)

◆ validate_version()

void VW::validate_version ( VW::workspace all)

◆ VERSION()

constexpr version_struct VW::VERSION ( VW_VERSION_MAJOR  ,
VW_VERSION_MINOR  ,
VW_VERSION_PATCH   
)
constexpr

◆ version()

constexpr version_struct VW::version ( VW_VERSION_MAJOR  ,
VW_VERSION_MINOR  ,
VW_VERSION_PATCH   
)
constexpr
Deprecated:
"VW::version renamed to VW::VERSION"

◆ wrap_text()

std::string VW::wrap_text ( VW::string_view  text,
size_t  width,
bool  wrap_after = true 
)
inline

Wrap text by whole words with the given column width.

Parameters
texttext to wrap
widthcolumn width to wrap to
wrap_afterif word causes line to exceed width include word on same line. If false, this word would be wrapped to the next line.
Returns
std::string copy of string with required newlines

◆ write_example_to_cache()

void VW::write_example_to_cache ( io_buf output,
VW::example ex_ptr,
VW::label_parser lbl_parser,
uint64_t  parse_mask,
VW::parsers::cache::details::cache_temp_buffer temp_buffer 
)
inline
Deprecated:
"VW::write_example_to_cache moved to VW::parsers::cache::write_example_to_cache"

Variable Documentation

◆ cb_eval_label_parser_global

VW::label_parser VW::cb_eval_label_parser_global
extern

◆ cb_label_parser_global

VW::label_parser VW::cb_label_parser_global
extern

◆ cb_with_observations_global

VW::label_parser VW::cb_with_observations_global
extern

◆ ccb_label_parser_global

VW::label_parser VW::ccb_label_parser_global
extern

◆ cs_label_parser_global

VW::label_parser VW::cs_label_parser_global
extern

◆ ENABLED_FEATURES

const std::string VW::ENABLED_FEATURES
extern

◆ GIT_COMMIT

const std::string VW::GIT_COMMIT
extern

◆ git_commit

const std::string VW::git_commit
extern
Deprecated:
"VW::git_commit renamed to VW::GIT_COMMIT"

◆ multiclass_label_parser_global

VW::label_parser VW::multiclass_label_parser_global
extern

◆ multilabel_label_parser_global

VW::label_parser VW::multilabel_label_parser_global
extern

◆ no_label_parser_global

VW::label_parser VW::no_label_parser_global
extern

◆ NUM_NAMESPACES

constexpr size_t VW::NUM_NAMESPACES = 256
constexpr

◆ simple_label_parser_global

VW::label_parser VW::simple_label_parser_global
extern