Skip to content

Conversation

@tomrf1
Copy link
Member

@tomrf1 tomrf1 commented Mar 17, 2025

A previous PR ensured that all variants in a "roulette" test get some share of the audience regardless of their score.
This PR refines this logic to ensure they get at least 10% of the share.

@tomrf1 tomrf1 changed the title Tf better min Better approach to minimum share in roulette Mar 17, 2025
});

it('should return second variant', () => {
it('should return third variant', () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test name was wrong here

@tomrf1 tomrf1 marked this pull request as ready for review March 17, 2025 14:16
@tomrf1 tomrf1 requested a review from a team as a code owner March 17, 2025 14:16
Copy link

@KentGrm KentGrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's an issue in the calculation of the solutions over 0.1. I also think there's a bias towards solutions with 0 over those with 0.11 - which should have a much higher value in comparison.

return {
variantName,
weight: Math.max(mean / sumOfMeans, minWeight),
weight: weight < minWeight ? minWeight : 0,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern with this is if you have v1 = 0 and v2 = 0.11. then clearly v2 is performing much better than v1. However, the min weight assignment will increase v1 to 0.1 giving a 0.01 difference to the two versions. This over promotes very poor solutions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, I guess this implementation assumes that variants have a low weight because we don't have enough data, rather than because they're just terrible!

const weights: { weight: number; variantName: string }[] = minimumWeights
.map(({ variantName, weight, mean }) => ({
variantName,
weight: weight === 0 ? remainder * (mean / sumOfNonReservedMeans) : weight,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the mean is 0.01 and the sumOfNonReservedMeans is 1, then this would be given a weight of 0.01 -- much lower than a variant at 0 which gets 0.1. Assuming I'm following the code correctly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at this point we're setting the weight for any variant that we know would get more than minWeight (0.1), so this should be ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants