Vowpal Wabbit
|
Namespaces | |
namespace | details |
Functions | |
template<typename It > | |
int | generate_epsilon_greedy (float epsilon, uint32_t top_action, It pmf_first, It pmf_last) |
Experimental: Generates epsilon-greedy style exploration distribution. More... | |
template<typename InputIt , typename OutputIt > | |
int | generate_softmax (float lambda, InputIt scores_first, InputIt scores_last, OutputIt pmf_first, OutputIt pmf_last) |
Generates softmax style exploration distribution. More... | |
template<typename InputIt , typename OutputIt > | |
int | generate_bag (InputIt top_actions_first, InputIt top_actions_last, OutputIt pmf_first, OutputIt pmf_last) |
Generates an exploration distribution according to votes on actions. More... | |
template<typename It > | |
int | enforce_minimum_probability (float uniform_epsilon, bool consider_zero_valued_elements, It pmf_first, It pmf_last) |
Updates the pmf to ensure each action is explored with at least minimum_uniform/num_actions. More... | |
template<typename It > | |
int | mix_with_uniform (float uniform_epsilon, It pmf_first, It pmf_last) |
Mix original PMF with uniform distribution. More... | |
template<typename It > | |
int | sample_after_normalizing (uint64_t seed, It pmf_first, It pmf_last, uint32_t &chosen_index) |
Sample an index from the provided pmf. If the pmf is not normalized it will be updated in-place. More... | |
template<typename It > | |
int | sample_after_normalizing (const char *seed, It pmf_first, It pmf_last, uint32_t &chosen_index) |
Sample an index from the provided pmf. If the pmf 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... | |
template<typename It > | |
int | sample_pdf (uint64_t *p_seed, It pdf_first, It pdf_last, float &chosen_value, float &pdf_value) |
Sample a continuous value from the provided pdf. More... | |
template<typename ActionsIt > | |
int | swap_chosen (ActionsIt action_first, ActionsIt action_last, uint32_t chosen_index) |
int VW::explore::enforce_minimum_probability | ( | float | uniform_epsilon, |
bool | consider_zero_valued_elements, | ||
It | pmf_first, | ||
It | pmf_last | ||
) |
Updates the pmf to ensure each action is explored with at least minimum_uniform/num_actions.
It | Iterator type of the pmf. Must be a RandomAccessIterator. |
uniform_epsilon | The minimum amount of uniform distribution to impose on the pmf. |
consider_zero_valued_elements | If true elements with zero probability are updated, otherwise those actions will be unchanged. |
pmf_first | Iterator pointing to the pre-allocated beginning of the pmf to be generated by this function. |
pmf_last | Iterator pointing to the pre-allocated end of the pmf to be generated by this function. |
int VW::explore::generate_bag | ( | InputIt | top_actions_first, |
InputIt | top_actions_last, | ||
OutputIt | pmf_first, | ||
OutputIt | pmf_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 pmf. 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. |
pmf_first | Iterator pointing to the pre-allocated beginning of the pmf to be generated by this function. |
pmf_last | Iterator pointing to the pre-allocated end of the pmf to be generated by this function. |
int VW::explore::generate_epsilon_greedy | ( | float | epsilon, |
uint32_t | top_action, | ||
It | pmf_first, | ||
It | pmf_last | ||
) |
Experimental: Generates epsilon-greedy style exploration distribution.
It | Iterator type of the pre-allocated pmf. 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). |
pmf_first | Iterator pointing to the pre-allocated beginning of the pmf to be generated by this function. |
pmf_last | Iterator pointing to the pre-allocated end of the pmf to be generated by this function. |
int VW::explore::generate_softmax | ( | float | lambda, |
InputIt | scores_first, | ||
InputIt | scores_last, | ||
OutputIt | pmf_first, | ||
OutputIt | pmf_last | ||
) |
Generates softmax style exploration distribution.
InputIt | Iterator type of the input scores. Must be an InputIterator. |
OutputIt | Iterator type of the pre-allocated pmf. 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. |
pmf_first | Iterator pointing to the pre-allocated beginning of the pmf to be generated by this function. |
pmf_last | Iterator pointing to the pre-allocated end of the pmf to be generated by this function. |
int VW::explore::mix_with_uniform | ( | float | uniform_epsilon, |
It | pmf_first, | ||
It | pmf_last | ||
) |
Mix original PMF with uniform distribution.
It | It Iterator type of the pmf. Must be a RandomAccessIterator. |
uniform_epsilon | The minimum amount of uniform distribution to be mixed with the pmf. |
pmf_first | Iterator pointing to the pmf to be updated. |
pmf_last | Iterator pointing to the pmf to be updated. |
int VW::explore::sample_after_normalizing | ( | const char * | seed, |
It | pmf_first, | ||
It | pmf_last, | ||
uint32_t & | chosen_index | ||
) |
Sample an index from the provided pmf. If the pmf is not normalized it will be updated in-place.
It | Iterator type of the pmf. Must be a RandomAccessIterator. |
seed | The seed for the pseudo-random generator. Will be hashed using MURMUR hash. |
pmf_first | Iterator pointing to the beginning of the pmf. |
pmf_last | Iterator pointing to the end of the pmf. |
chosen_index | returns the chosen index. |
int VW::explore::sample_after_normalizing | ( | uint64_t | seed, |
It | pmf_first, | ||
It | pmf_last, | ||
uint32_t & | chosen_index | ||
) |
Sample an index from the provided pmf. If the pmf is not normalized it will be updated in-place.
InputIt | Iterator type of the pmf. Must be a RandomAccessIterator. |
seed | The seed for the pseudo-random generator. |
pmf_first | Iterator pointing to the beginning of the pmf. |
pmf_last | Iterator pointing to the end of the pmf. |
chosen_index | returns the chosen index. |
int VW::explore::sample_pdf | ( | uint64_t * | p_seed, |
It | pdf_first, | ||
It | pdf_last, | ||
float & | chosen_value, | ||
float & | pdf_value | ||
) |
Sample a continuous value from the provided pdf.
Warning: seed
must be sufficiently random for the PRNG to produce uniform random values. Using sequential seeds will result in a very biased distribution. If unsure how to update seed between calls, merand48 (in random_details.h) can be used to inplace mutate it.
It | Iterator type of the pmf. Must be a RandomAccessIterator. |
p_seed | The seed for the pseudo-random generator. Will be hashed using MURMUR hash. The seed state will be advanced |
pdf_first | Iterator pointing to the beginning of the pdf. |
pdf_last | Iterator pointing to the end of the pdf. |
chosen_value | returns the sampled continuous value. |
pdf_value | returns the probablity density at the sampled location. |
int VW::explore::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 |
int VW::explore::swap_chosen | ( | ActionsIt | action_first, |
ActionsIt | action_last, | ||
uint32_t | chosen_index | ||
) |