-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update beta
distribution parameters
#643
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…iment.ipynb Update the beta distribution parameters in the `simulate_experiment` function to avoid bias towards lower success probability. The current specification of the beta distribution: ``` theta = np.random.beta(conversions + 1, exposures + 1) ``` treats every exposure as a failure, that is overstates the failures thus undervalues the success probabilities of the variations. The effect is pronounced for variations with very high baseline conversion rates but less severe for variations with extremely low conversion rates. Traditionally, the Thompson Sampling Algorithm for the Bernoulli Bandit is: ```math \begin{align*} 1: & \text{for } t = 1, 2, \ldots \text{ do:} \\ 2: & \quad \quad \text{Sample model:} \\ 3: & \quad \quad \text{for } k = 1 \text{ to } K \text{ do:} \\ 4: & \quad \quad \quad \text{Sample } \theta_k \sim \text{beta}(\alpha_k, \beta_k) \\ 5: & \quad \quad \text{$$end for$$} \\ 6: \\ 7: & \quad \quad \text{Select and apply action:} \\ 8: & \quad \quad x_t \leftarrow argmax_k \theta_k \\ 9: & \quad \quad \text{Apply } x_t \text{ and observe } r_t \\ 10: \\ 11: & \quad \quad \text{Update distribution:} \\ 12: & \quad \quad (\alpha_{x_t}, \beta_{x_t}) \leftarrow (\alpha_{x_t} + r_t, \beta_{x_t} + 1 - r_t) \\ 13: & \text{end for} \end{align*} ``` Where α, β represent the parameters of each arm i.e. the success and failure counts, respectively OR the number of `conversions` and `non-conversions`, respectively. ``` non-conversions (or beta) = exposures - conversions ```
james-jory
approved these changes
Oct 4, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for catching this oversight!
MustaphaU
added a commit
to MustaphaU/retail-demo-store
that referenced
this pull request
Oct 4, 2024
…ndex` method Update the beta distribution parameters in the `_select_variation_index` method to avoid bias towards lower success probability. The current specification of the beta distribution: ``` theta = np.random.beta(conversions + 1, exposures + 1) ``` treats every exposure as a failure, that is overstates the failures thus undervalues the success probabilities of the variations. The effect is pronounced for variations with very high baseline conversion rates but less severe for variations with extremely low conversion rates. aws-samples#643
Thank you @james-jory ! |
james-jory
added a commit
that referenced
this pull request
Oct 28, 2024
…ndex` method (#647) Update the beta distribution parameters in the `_select_variation_index` method to avoid bias towards lower success probability. The current specification of the beta distribution: ``` theta = np.random.beta(conversions + 1, exposures + 1) ``` treats every exposure as a failure, that is overstates the failures thus undervalues the success probabilities of the variations. The effect is pronounced for variations with very high baseline conversion rates but less severe for variations with extremely low conversion rates. #643 Co-authored-by: James Jory <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
Description of changes:
Update the beta distribution parameters in the
simulate_experiment
function to avoid bias towards lower success probability.The current specification of the beta distribution:
treats every exposure as a failure, that is overstates the failures thus undervalues the success probabilities of the variations. The effect is pronounced for variations with very high baseline conversion rates but less severe for variations with extremely low conversion rates.
Traditionally, the Thompson Sampling Algorithm for the Bernoulli Bandit Thompson Sampling algorithm is:
Where α, β represent the parameters of each arm i.e. the success and failure counts, respectively OR the number of
conversions
andnon-conversions
, respectively.Description of testing performed to validate your changes (required if pull request includes CloudFormation or source code changes):
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.