Vowpal Wabbit
|
Classes | |
union | int_float |
Functions | |
template<typename It > | |
int | generate_epsilon_greedy (float epsilon, uint32_t top_action, It pdf_first, It pdf_last) |
Generates epsilon-greedy style exploration distribution. More... | |
template<typename InputIt , typename OutputIt > | |
int | generate_softmax (float lambda, InputIt scores_first, InputIt scores_last, OutputIt pdf_first, OutputIt pdf_last) |
Generates softmax style exploration distribution. More... | |
template<typename InputIt , typename OutputIt > | |
int | generate_bag (InputIt top_actions_first, InputIt top_actions_last, OutputIt pdf_first, OutputIt pdf_last) |
Generates an exploration distribution according to votes on actions. More... | |
template<typename It > | |
int | enforce_minimum_probability (float minimum_uniform, bool update_zero_elements, It pdf_first, It pdf_last) |
Updates the pdf to ensure each action is explored with at least minimum_uniform/num_actions. More... | |
template<typename It > | |
int | sample_after_normalizing (uint64_t seed, It pdf_first, It pdf_last, uint32_t &chosen_index) |
Sample an index from the provided pdf. If the pdf is not normalized it will be updated in-place. More... | |
template<typename It > | |
int | sample_after_normalizing (const char *seed, It pdf_first, It pdf_last, uint32_t &chosen_index) |
Sample an index from the provided pdf. If the pdf is not normalized it will be updated in-place. More... | |
template<typename ActionIt > | |
int | swap_chosen (ActionIt action_first, ActionIt action_last, uint32_t chosen_index) |
Swap the first value with the chosen index. More... | |
float | uniform_random_merand48 (uint64_t initial) |
template<typename It > | |
int | generate_epsilon_greedy (float epsilon, uint32_t top_action, It pdf_first, It pdf_last, std::random_access_iterator_tag) |
template<typename InputIt , typename OutputIt > | |
int | generate_softmax (float lambda, InputIt scores_first, InputIt scores_last, std::input_iterator_tag, OutputIt pdf_first, OutputIt pdf_last, std::random_access_iterator_tag) |
template<typename InputIt , typename OutputIt > | |
int | generate_bag (InputIt top_actions_first, InputIt top_actions_last, std::input_iterator_tag, OutputIt pdf_first, OutputIt pdf_last, std::random_access_iterator_tag) |
template<typename It > | |
int | enforce_minimum_probability (float minimum_uniform, bool update_zero_elements, It pdf_first, It pdf_last, std::random_access_iterator_tag) |
template<typename It > | |
int | sample_after_normalizing (uint64_t seed, It pdf_first, It pdf_last, uint32_t &chosen_index, std::input_iterator_tag) |
template<typename It > | |
int | sample_after_normalizing (const char *seed, It pdf_first, It pdf_last, uint32_t &chosen_index, std::random_access_iterator_tag pdf_category) |
template<typename ActionIt > | |
int | swap_chosen (ActionIt action_first, ActionIt action_last, std::forward_iterator_tag, uint32_t chosen_index) |
template<typename ActionsIt > | |
int | swap_chosen (ActionsIt action_first, ActionsIt action_last, uint32_t chosen_index) |
Variables | |
const uint64_t | a = 0xeece66d5deece66dULL |
const uint64_t | c = 2147483647 |
const int | bias = 127 << 23u |
int exploration::enforce_minimum_probability | ( | float | minimum_uniform, |
bool | update_zero_elements, | ||
It | pdf_first, | ||
It | pdf_last | ||
) |
Updates the pdf to ensure each action is explored with at least minimum_uniform/num_actions.
It | Iterator type of the pdf. Must be a RandomAccessIterator. |
minimum_uniform | The minimum amount of uniform distribution to impose on the pdf. |
update_zero_elements | If true elements with zero probability are updated, otherwise those actions will be unchanged. |
pdf_first | Iterator pointing to the pre-allocated beginning of the pdf to be generated by this function. |
pdf_last | Iterator pointing to the pre-allocated end of the pdf to be generated by this function. |
Definition at line 226 of file explore_internal.h.
Referenced by CB_EXPLORE::get_cover_probabilities(), vw_slim::vw_predict< W >::predict(), VW::cb_explore_adf::softmax::cb_explore_adf_softmax::predict_or_learn_impl(), VW::cb_explore_adf::first::cb_explore_adf_first::predict_or_learn_impl(), VW::cb_explore_adf::bag::cb_explore_adf_bag::predict_or_learn_impl(), VW::cb_explore_adf::cover::cb_explore_adf_cover::predict_or_learn_impl(), VW::cb_explore_adf::regcb::cb_explore_adf_regcb::predict_or_learn_impl(), and TEST().
int exploration::enforce_minimum_probability | ( | float | minimum_uniform, |
bool | update_zero_elements, | ||
It | pdf_first, | ||
It | pdf_last, | ||
std::random_access_iterator_tag | |||
) |
Definition at line 158 of file explore_internal.h.
References E_EXPLORATION_BAD_RANGE, prediction_type::prob, and S_EXPLORATION_OK.
int exploration::generate_bag | ( | InputIt | top_actions_first, |
InputIt | top_actions_last, | ||
OutputIt | pdf_first, | ||
OutputIt | pdf_last | ||
) |
Generates an exploration distribution according to votes on actions.
InputIt | Iterator type of the input actions. Must be an InputIterator. |
OutputIt | Iterator type of the pre-allocated pdf. Must be a RandomAccessIterator. |
top_actions_first | Iterator pointing to the beginning of the top actions. |
top_actions_last | Iterator pointing to the end of the top actions. |
pdf_first | Iterator pointing to the pre-allocated beginning of the pdf to be generated by this function. |
pdf_last | Iterator pointing to the pre-allocated end of the pdf to be generated by this function. |
Definition at line 149 of file explore_internal.h.
Referenced by vw_slim::vw_predict< W >::predict(), VW::cb_explore_adf::bag::cb_explore_adf_bag::predict_or_learn_impl(), and TEST().
int exploration::generate_bag | ( | InputIt | top_actions_first, |
InputIt | top_actions_last, | ||
std::input_iterator_tag | , | ||
OutputIt | pdf_first, | ||
OutputIt | pdf_last, | ||
std::random_access_iterator_tag | |||
) |
Definition at line 122 of file explore_internal.h.
References accumulate(), E_EXPLORATION_BAD_RANGE, and S_EXPLORATION_OK.
int exploration::generate_epsilon_greedy | ( | float | epsilon, |
uint32_t | top_action, | ||
It | pdf_first, | ||
It | pdf_last | ||
) |
Generates epsilon-greedy style exploration distribution.
It | Iterator type of the pre-allocated pdf. Must be a RandomAccessIterator. |
epsilon | Minimum probability used to explore among options. Each action is explored with at least epsilon/num_actions. |
top_action | Index of the exploit actions. This action will be get probability mass of 1-epsilon + (epsilon/num_actions). |
pdf_first | Iterator pointing to the pre-allocated beginning of the pdf to be generated by this function. |
pdf_last | Iterator pointing to the pre-allocated end of the pdf to be generated by this function. |
Definition at line 61 of file explore_internal.h.
Referenced by vw_slim::vw_predict< W >::predict(), CB_EXPLORE::predict_or_learn_greedy(), and TEST().
int exploration::generate_epsilon_greedy | ( | float | epsilon, |
uint32_t | top_action, | ||
It | pdf_first, | ||
It | pdf_last, | ||
std::random_access_iterator_tag | |||
) |
Definition at line 38 of file explore_internal.h.
References E_EXPLORATION_BAD_RANGE, exploration::int_float::f, prediction_type::prob, and S_EXPLORATION_OK.
int exploration::generate_softmax | ( | float | lambda, |
InputIt | scores_first, | ||
InputIt | scores_last, | ||
OutputIt | pdf_first, | ||
OutputIt | pdf_last | ||
) |
Generates softmax style exploration distribution.
InputIt | Iterator type of the input scores. Must be an InputIterator. |
OutputIt | Iterator type of the pre-allocated pdf. Must be a RandomAccessIterator. |
lambda | Lambda parameter of softmax. |
scores_first | Iterator pointing to beginning of the scores. |
scores_last | Iterator pointing to end of the scores. |
pdf_first | Iterator pointing to the pre-allocated beginning of the pdf to be generated by this function. |
pdf_last | Iterator pointing to the pre-allocated end of the pdf to be generated by this function. |
Definition at line 113 of file explore_internal.h.
Referenced by CB_ADF::cb_adf::learn_SM(), vw_slim::vw_predict< W >::predict(), VW::cb_explore_adf::softmax::cb_explore_adf_softmax::predict_or_learn_impl(), and TEST().
int exploration::generate_softmax | ( | float | lambda, |
InputIt | scores_first, | ||
InputIt | scores_last, | ||
std::input_iterator_tag | , | ||
OutputIt | pdf_first, | ||
OutputIt | pdf_last, | ||
std::random_access_iterator_tag | |||
) |
Definition at line 68 of file explore_internal.h.
References E_EXPLORATION_BAD_RANGE, prediction_type::prob, and S_EXPLORATION_OK.
int exploration::sample_after_normalizing | ( | uint64_t | seed, |
It | pdf_first, | ||
It | pdf_last, | ||
uint32_t & | chosen_index | ||
) |
Sample an index from the provided pdf. If the pdf is not normalized it will be updated in-place.
InputIt | Iterator type of the pdf. Must be a RandomAccessIterator. |
seed | The seed for the pseudo-random generator. |
pdf_first | Iterator pointing to the beginning of the pdf. |
pdf_last | Iterator pointing to the end of the pdf. |
chosen_index | returns the chosen index. |
Definition at line 286 of file explore_internal.h.
Referenced by do_actual_learning_ldf(), VW::cb_sample_data::learn_or_predict(), vw_slim::vw_predict< W >::predict(), predict_bandit_adf(), predict_or_learn(), predict_or_learn_adf(), sample_after_normalizing(), and TEST().
int exploration::sample_after_normalizing | ( | const char * | seed, |
It | pdf_first, | ||
It | pdf_last, | ||
uint32_t & | chosen_index | ||
) |
Sample an index from the provided pdf. If the pdf is not normalized it will be updated in-place.
It | Iterator type of the pdf. Must be a RandomAccessIterator. |
seed | The seed for the pseudo-random generator. Will be hashed using MURMUR hash. |
pdf_first | Iterator pointing to the beginning of the pdf. |
pdf_last | Iterator pointing to the end of the pdf. |
chosen_index | returns the chosen index. |
Definition at line 304 of file explore_internal.h.
References sample_after_normalizing().
int exploration::sample_after_normalizing | ( | uint64_t | seed, |
It | pdf_first, | ||
It | pdf_last, | ||
uint32_t & | chosen_index, | ||
std::input_iterator_tag | |||
) |
Definition at line 236 of file explore_internal.h.
References E_EXPLORATION_BAD_RANGE, exploration::int_float::i, S_EXPLORATION_OK, and uniform_random_merand48().
int exploration::sample_after_normalizing | ( | const char * | seed, |
It | pdf_first, | ||
It | pdf_last, | ||
uint32_t & | chosen_index, | ||
std::random_access_iterator_tag | pdf_category | ||
) |
Definition at line 295 of file explore_internal.h.
References sample_after_normalizing(), and uniform_hash().
int exploration::swap_chosen | ( | ActionIt | action_first, |
ActionIt | action_last, | ||
uint32_t | chosen_index | ||
) |
Swap the first value with the chosen index.
ActionIt | Iterator type of the action. Must be a forward_iterator. |
action_first | Iterator pointing to the beginning of the pdf. |
action_last | Iterator pointing to the end of the pdf. |
chosen_index | The index value that should be swapped with the first element |
Referenced by VW::cb_sample_data::learn_or_predict(), and swap_chosen().
int exploration::swap_chosen | ( | ActionIt | action_first, |
ActionIt | action_last, | ||
std::forward_iterator_tag | , | ||
uint32_t | chosen_index | ||
) |
Definition at line 311 of file explore_internal.h.
References E_EXPLORATION_BAD_RANGE, and S_EXPLORATION_OK.
int exploration::swap_chosen | ( | ActionsIt | action_first, |
ActionsIt | action_last, | ||
uint32_t | chosen_index | ||
) |
Definition at line 333 of file explore_internal.h.
References swap_chosen().
|
inline |
Definition at line 29 of file explore_internal.h.
References bias, c, exploration::int_float::f, and exploration::int_float::i.
Referenced by sample_after_normalizing(), and TYPED_TEST_P().
const uint64_t exploration::a = 0xeece66d5deece66dULL |
Definition at line 17 of file explore_internal.h.
const int exploration::bias = 127 << 23u |
Definition at line 20 of file explore_internal.h.
Referenced by uniform_random_merand48().
const uint64_t exploration::c = 2147483647 |
Definition at line 18 of file explore_internal.h.
Referenced by uniform_random_merand48().