Skip to content
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

chore(experiments): Use delta instead of places in tests #27150

Closed
wants to merge 1 commit into from

Conversation

danielbachhuber
Copy link
Contributor

See #26713

Changes

Uses delta with assertAlmostEqual instead of places to account for some degree of variability in statistical evaluations.

How did you test this code?

Tests should pass.

@danielbachhuber danielbachhuber requested a review from a team December 24, 2024 12:57
@@ -73,12 +73,12 @@ def run_test(stats_version, calculate_probabilities, are_results_significant, ca
self.assertEqual(p_value, 1)

# Control: ~10% conversion rate with wide interval due to small sample
self.assertAlmostEqual(intervals["control"][0], 0.055, places=2) # Lower bound ~5.5%
self.assertAlmostEqual(intervals["control"][1], 0.182, places=2) # Upper bound ~18.2%
self.assertAlmostEqual(intervals["control"][0], 0.055, delta=0.02) # Lower bound ~5.5%
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is unexpected to me, is it acceptable for this calculation to return 7.4% instead of 5.5%?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@neilkakkar We're using the same test against both the first methodology and the second methodology. The two methodologies produce slightly different results (and the first methodology a higher degree of variability), so I've been working around that with delta.

But, it's a good question. I'm going to re-roll this PR and split out the assertions across all of the tests. Thanks for the review!

@danielbachhuber danielbachhuber deleted the experiments/use-delta-count branch December 24, 2024 13:25
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