-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat(experiments): Apply new Trends continuous stats methods #26835
Conversation
@andehen It would be really helpful if you could produce some sample values with your notebook. I can then implement those in tests and we can see where we're at for the |
@andehen |
This reverts commit 858d7b4.
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.
Looks great! Why not already plug it into the query runner though?
posthog/posthog/hogql_queries/experiments/experiment_trends_query_runner.py
Lines 318 to 319 in f34bea5
if self.stats_version == 2: | |
probabilities = calculate_probabilities_v2_count(control_variant, test_variants) |
My thought on Friday was to ship what I have incrementally. |
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.
Looks good! 👍 Didn't spot any errors in the code it self.
As we have talked about, the key issue to address further is the assumption of a fixed variance. If one run test now, where the actual variance in the data is higher, we will claim that the results are significant when they should not be. We can use a higher value to protect against this, at the cost of saying "not significant" when we likely could (in the event that variance is lower than we assume). Really hard to say what the value should be without doing an analysis on actual data 🤷
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.
Looks great, thanks for doing this!
@andehen, could you please create an issue with a detailed description to track the concern mentioned in your comment? It's important to keep track of this, though I consider it non-blocking for now. This calculation is already a big improvement over the current state of things :)
@danielbachhuber there's an issue here I've only spotted now: We're still overwriting the math property from AVG to SUM. So the new probability method will never receive AVG. This went unnoticed because we're only unit-testing the probability method, and not including it in a more integrated query runner test. Would be nice to have a small test within |
Resolved with #27133 |
See #26713
Changes
Introduces a new set of methods for calculating Trends continuous values:
calculate_probabilities_v2_continuous
are_results_significant_v2_continuous
calculate_credible_intervals_v2_continuous
calculate_expected_loss_v2_continuous
Uses the Trends continuous methods when
stats_version=2
.Also introduces expected loss calculation for Trends count.
How did you test this code?
Tests should pass.