Vowpal Wabbit
Classes | Typedefs | Functions | Variables
INTERACTIONS Namespace Reference

Classes

struct  extent_interaction_expansion_stack_item
 
struct  feature_gen_data
 
struct  generate_interactions_object_cache
 
struct  interactions_generator
 

Typedefs

template<typename T >
using generate_func_t = std::vector< std::vector< T > >(const std::set< T > &namespaces, size_t num_to_pick)
 
using features_range_t = std::pair< features::const_audit_iterator, features::const_audit_iterator >
 

Functions

template<class R , class S , void(*)(R &, float, S) T, bool audit, void(*)(R &, const audit_strings *) audit_func>
void generate_interactions (VW::workspace &all, 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, example_predict &ec, R &dat, size_t &num_interacted_features)
 
VW::LEARNER::base_learnergenerate_interactions_setup (VW::config::options_i &options, VW::workspace &all)
 
constexpr bool is_interaction_ns (const unsigned char ns)
 
bool contains_wildcard (const std::vector< namespace_index > &interaction)
 
bool contains_wildcard (const std::vector< extent_term > &interaction)
 
float eval_sum_ft_squared_of_generated_ft (bool permutations, const std::vector< std::vector< namespace_index >> &interactions, const std::vector< std::vector< extent_term >> &extent_interactions, const std::array< features, NUM_NAMESPACES > &feature_spaces)
 
template<typename T >
std::vector< T > indices_to_values_one_based (const std::vector< size_t > &indices, const std::set< T > &values)
 
template<typename T >
std::vector< T > indices_to_values_ignore_last_index (const std::vector< size_t > &indices, const std::set< T > &values)
 
template<typename T >
bool must_be_left_sorted (const std::vector< T > &oi)
 
template<typename T >
void sort_and_filter_duplicate_interactions (std::vector< std::vector< T >> &vec, bool filter_duplicates, size_t &removed_cnt, size_t &sorted_cnt)
 
template<typename T >
std::vector< std::vector< T > > generate_namespace_combinations_with_repetition (const std::set< T > &namespaces, size_t num_to_pick)
 
template<typename T >
std::vector< std::vector< T > > generate_namespace_permutations_with_repetition (const std::set< T > &namespaces, size_t num_to_pick)
 
std::vector< std::vector< namespace_index > > expand_quadratics_wildcard_interactions (bool leave_duplicate_interactions, const std::set< namespace_index > &new_example_indices)
 
bool sort_interactions_comparator (const std::vector< namespace_index > &a, const std::vector< namespace_index > &b)
 
template<generate_func_t< namespace_index > generate_func, bool leave_duplicate_interactions>
std::vector< std::vector< namespace_index > > compile_interaction (const std::vector< namespace_index > &interaction, const std::set< namespace_index > &indices)
 
template<generate_func_t< extent_term > generate_func, bool leave_duplicate_interactions>
std::vector< std::vector< extent_term > > compile_extent_interaction (const std::vector< extent_term > &interaction, const std::set< extent_term > &all_seen_extents)
 
template<generate_func_t< namespace_index > generate_func, bool leave_duplicate_interactions>
std::vector< std::vector< namespace_index > > compile_interactions (const std::vector< std::vector< namespace_index >> &interactions, const std::set< namespace_index > &indices)
 
template<generate_func_t< extent_term > generate_func, bool leave_duplicate_interactions>
std::vector< std::vector< extent_term > > compile_extent_interactions (const std::vector< std::vector< extent_term >> &interactions, const std::set< extent_term > &indices)
 
template<class DataT , void(*)(DataT &, const float, float &) FuncT, class WeightsT >
void call_FuncT (DataT &dat, WeightsT &weights, const float ft_value, const uint64_t ft_idx)
 
template<class DataT , void(*)(DataT &, const float, float) FuncT, class WeightsT >
void call_FuncT (DataT &dat, const WeightsT &weights, const float ft_value, const uint64_t ft_idx)
 
bool term_is_empty (namespace_index term, const std::array< features, NUM_NAMESPACES > &feature_groups)
 
bool has_empty_interaction_quadratic (const std::array< features, NUM_NAMESPACES > &feature_groups, const std::vector< namespace_index > &namespace_indexes)
 
bool has_empty_interaction_cubic (const std::array< features, NUM_NAMESPACES > &feature_groups, const std::vector< namespace_index > &namespace_indexes)
 
bool has_empty_interaction (const std::array< features, NUM_NAMESPACES > &feature_groups, const std::vector< namespace_index > &namespace_indexes)
 
bool has_empty_interaction (const std::array< features, NUM_NAMESPACES > &feature_groups, const std::vector< extent_term > &namespace_indexes)
 
float INTERACTION_VALUE (float value1, float value2)
 
std::tuple< features_range_t, features_range_tgenerate_quadratic_char_combination (const std::array< features, NUM_NAMESPACES > &feature_groups, namespace_index ns_idx1, namespace_index ns_idx2)
 
template<typename DispatchCombinationFuncT >
void generate_generic_extent_combination_iterative (const std::array< features, NUM_NAMESPACES > &feature_groups, const std::vector< extent_term > &terms, const DispatchCombinationFuncT &dispatch_combination_func, std::stack< extent_interaction_expansion_stack_item > &in_process_frames, VW::moved_object_pool< extent_interaction_expansion_stack_item > &frame_pool)
 
std::tuple< features_range_t, features_range_t, features_range_tgenerate_cubic_char_combination (const std::array< features, NUM_NAMESPACES > &feature_groups, namespace_index ns_idx1, namespace_index ns_idx2, namespace_index ns_idx3)
 
std::vector< features_range_tgenerate_generic_char_combination (const std::array< features, NUM_NAMESPACES > &feature_groups, const std::vector< namespace_index > &terms)
 
template<class DataT , class WeightOrIndexT , void(*)(DataT &, float, WeightOrIndexT) FuncT, bool audit, void(*)(DataT &, const audit_strings *) audit_func, class WeightsT >
void inner_kernel (DataT &dat, features::const_audit_iterator &begin, features::const_audit_iterator &end, const uint64_t offset, WeightsT &weights, feature_value ft_value, feature_index halfhash)
 
template<bool Audit, typename KernelFuncT , typename AuditFuncT >
size_t process_quadratic_interaction (const std::tuple< features_range_t, features_range_t > &range, bool permutations, const KernelFuncT &kernel_func, const AuditFuncT &audit_func)
 
template<bool Audit, typename KernelFuncT , typename AuditFuncT >
size_t process_cubic_interaction (const std::tuple< features_range_t, features_range_t, features_range_t > &range, bool permutations, const KernelFuncT &kernel_func, const AuditFuncT &audit_func)
 
template<bool Audit, typename KernelFuncT , typename AuditFuncT >
size_t process_generic_interaction (const std::vector< features_range_t > &range, bool permutations, const KernelFuncT &kernel_func, const AuditFuncT &audit_func, std::vector< feature_gen_data > &state_data)
 
template<class DataT , class WeightOrIndexT , void(*)(DataT &, float, WeightOrIndexT) FuncT, bool audit, void(*)(DataT &, const audit_strings *) audit_func, class WeightsT >
void generate_interactions (const std::vector< std::vector< namespace_index >> &interactions, const std::vector< std::vector< extent_term >> &extent_interactions, bool permutations, example_predict &ec, DataT &dat, WeightsT &weights, size_t &num_features, generate_interactions_object_cache &cache)
 

Variables

constexpr unsigned char interaction_ns_start = ' '
 
constexpr unsigned char interaction_ns_end = '~'
 

Typedef Documentation

◆ features_range_t

◆ generate_func_t

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

Function Documentation

◆ call_FuncT() [1/2]

template<class DataT , void(*)(DataT &, const float, float &) FuncT, class WeightsT >
void INTERACTIONS::call_FuncT ( DataT &  dat,
WeightsT &  weights,
const float  ft_value,
const uint64_t  ft_idx 
)
inline

◆ call_FuncT() [2/2]

template<class DataT , void(*)(DataT &, const float, float) FuncT, class WeightsT >
void INTERACTIONS::call_FuncT ( DataT &  dat,
const WeightsT &  weights,
const float  ft_value,
const uint64_t  ft_idx 
)
inline

◆ compile_extent_interaction()

template<generate_func_t< extent_term > generate_func, bool leave_duplicate_interactions>
std::vector<std::vector<extent_term> > INTERACTIONS::compile_extent_interaction ( const std::vector< extent_term > &  interaction,
const std::set< extent_term > &  all_seen_extents 
)

◆ compile_extent_interactions()

template<generate_func_t< extent_term > generate_func, bool leave_duplicate_interactions>
std::vector<std::vector<extent_term> > INTERACTIONS::compile_extent_interactions ( const std::vector< std::vector< extent_term >> &  interactions,
const std::set< extent_term > &  indices 
)

◆ compile_interaction()

template<generate_func_t< namespace_index > generate_func, bool leave_duplicate_interactions>
std::vector<std::vector<namespace_index> > INTERACTIONS::compile_interaction ( const std::vector< namespace_index > &  interaction,
const std::set< namespace_index > &  indices 
)

◆ compile_interactions()

template<generate_func_t< namespace_index > generate_func, bool leave_duplicate_interactions>
std::vector<std::vector<namespace_index> > INTERACTIONS::compile_interactions ( const std::vector< std::vector< namespace_index >> &  interactions,
const std::set< namespace_index > &  indices 
)

◆ contains_wildcard() [1/2]

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

◆ contains_wildcard() [2/2]

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

◆ eval_sum_ft_squared_of_generated_ft()

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

◆ expand_quadratics_wildcard_interactions()

std::vector<std::vector<namespace_index> > INTERACTIONS::expand_quadratics_wildcard_interactions ( bool  leave_duplicate_interactions,
const std::set< namespace_index > &  new_example_indices 
)

◆ generate_cubic_char_combination()

std::tuple<features_range_t, features_range_t, features_range_t> INTERACTIONS::generate_cubic_char_combination ( const std::array< features, NUM_NAMESPACES > &  feature_groups,
namespace_index  ns_idx1,
namespace_index  ns_idx2,
namespace_index  ns_idx3 
)
inline

◆ generate_generic_char_combination()

std::vector<features_range_t> INTERACTIONS::generate_generic_char_combination ( const std::array< features, NUM_NAMESPACES > &  feature_groups,
const std::vector< namespace_index > &  terms 
)
inline

◆ generate_generic_extent_combination_iterative()

template<typename DispatchCombinationFuncT >
void INTERACTIONS::generate_generic_extent_combination_iterative ( const std::array< features, NUM_NAMESPACES > &  feature_groups,
const std::vector< extent_term > &  terms,
const DispatchCombinationFuncT &  dispatch_combination_func,
std::stack< extent_interaction_expansion_stack_item > &  in_process_frames,
VW::moved_object_pool< extent_interaction_expansion_stack_item > &  frame_pool 
)

◆ generate_interactions() [1/3]

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

◆ generate_interactions() [2/3]

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

◆ generate_interactions() [3/3]

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

◆ generate_interactions_setup()

VW::LEARNER::base_learner* INTERACTIONS::generate_interactions_setup ( VW::config::options_i options,
VW::workspace all 
)

◆ generate_namespace_combinations_with_repetition()

template<typename T >
std::vector<std::vector<T> > INTERACTIONS::generate_namespace_combinations_with_repetition ( const std::set< T > &  namespaces,
size_t  num_to_pick 
)

◆ generate_namespace_permutations_with_repetition()

template<typename T >
std::vector<std::vector<T> > INTERACTIONS::generate_namespace_permutations_with_repetition ( const std::set< T > &  namespaces,
size_t  num_to_pick 
)

◆ generate_quadratic_char_combination()

std::tuple<features_range_t, features_range_t> INTERACTIONS::generate_quadratic_char_combination ( const std::array< features, NUM_NAMESPACES > &  feature_groups,
namespace_index  ns_idx1,
namespace_index  ns_idx2 
)
inline

◆ has_empty_interaction() [1/2]

bool INTERACTIONS::has_empty_interaction ( const std::array< features, NUM_NAMESPACES > &  feature_groups,
const std::vector< namespace_index > &  namespace_indexes 
)
inline

◆ has_empty_interaction() [2/2]

bool INTERACTIONS::has_empty_interaction ( const std::array< features, NUM_NAMESPACES > &  feature_groups,
const std::vector< extent_term > &  namespace_indexes 
)
inline

◆ has_empty_interaction_cubic()

bool INTERACTIONS::has_empty_interaction_cubic ( const std::array< features, NUM_NAMESPACES > &  feature_groups,
const std::vector< namespace_index > &  namespace_indexes 
)
inline

◆ has_empty_interaction_quadratic()

bool INTERACTIONS::has_empty_interaction_quadratic ( const std::array< features, NUM_NAMESPACES > &  feature_groups,
const std::vector< namespace_index > &  namespace_indexes 
)
inline

◆ indices_to_values_ignore_last_index()

template<typename T >
std::vector<T> INTERACTIONS::indices_to_values_ignore_last_index ( const std::vector< size_t > &  indices,
const std::set< T > &  values 
)

◆ indices_to_values_one_based()

template<typename T >
std::vector<T> INTERACTIONS::indices_to_values_one_based ( const std::vector< size_t > &  indices,
const std::set< T > &  values 
)

◆ inner_kernel()

template<class DataT , class WeightOrIndexT , void(*)(DataT &, float, WeightOrIndexT) FuncT, bool audit, void(*)(DataT &, const audit_strings *) audit_func, class WeightsT >
void INTERACTIONS::inner_kernel ( DataT &  dat,
features::const_audit_iterator begin,
features::const_audit_iterator end,
const uint64_t  offset,
WeightsT &  weights,
feature_value  ft_value,
feature_index  halfhash 
)

◆ INTERACTION_VALUE()

float INTERACTIONS::INTERACTION_VALUE ( float  value1,
float  value2 
)
inline

◆ is_interaction_ns()

constexpr bool INTERACTIONS::is_interaction_ns ( const unsigned char  ns)
inline

◆ must_be_left_sorted()

template<typename T >
bool INTERACTIONS::must_be_left_sorted ( const std::vector< T > &  oi)
inline

◆ process_cubic_interaction()

template<bool Audit, typename KernelFuncT , typename AuditFuncT >
size_t INTERACTIONS::process_cubic_interaction ( const std::tuple< features_range_t, features_range_t, features_range_t > &  range,
bool  permutations,
const KernelFuncT &  kernel_func,
const AuditFuncT &  audit_func 
)

◆ process_generic_interaction()

template<bool Audit, typename KernelFuncT , typename AuditFuncT >
size_t INTERACTIONS::process_generic_interaction ( const std::vector< features_range_t > &  range,
bool  permutations,
const KernelFuncT &  kernel_func,
const AuditFuncT &  audit_func,
std::vector< feature_gen_data > &  state_data 
)

◆ process_quadratic_interaction()

template<bool Audit, typename KernelFuncT , typename AuditFuncT >
size_t INTERACTIONS::process_quadratic_interaction ( const std::tuple< features_range_t, features_range_t > &  range,
bool  permutations,
const KernelFuncT &  kernel_func,
const AuditFuncT &  audit_func 
)

◆ sort_and_filter_duplicate_interactions()

template<typename T >
void INTERACTIONS::sort_and_filter_duplicate_interactions ( std::vector< std::vector< T >> &  vec,
bool  filter_duplicates,
size_t &  removed_cnt,
size_t &  sorted_cnt 
)

◆ sort_interactions_comparator()

bool INTERACTIONS::sort_interactions_comparator ( const std::vector< namespace_index > &  a,
const std::vector< namespace_index > &  b 
)

◆ term_is_empty()

bool INTERACTIONS::term_is_empty ( namespace_index  term,
const std::array< features, NUM_NAMESPACES > &  feature_groups 
)
inline

Variable Documentation

◆ interaction_ns_end

constexpr unsigned char INTERACTIONS::interaction_ns_end = '~'

◆ interaction_ns_start

constexpr unsigned char INTERACTIONS::interaction_ns_start = ' '