feat(experimentation): Bayesian stats kernel#7769
Draft
gagantrivedi wants to merge 1 commit into
Draft
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
c406904 to
16e699b
Compare
16e699b to
79af371
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7769 +/- ##
========================================
Coverage 98.56% 98.56%
========================================
Files 1459 1461 +2
Lines 56134 56237 +103
========================================
+ Hits 55327 55430 +103
Misses 807 807 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
79af371 to
a8ba0c8
Compare
This file contains hidden or 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
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.
docs/if required so people know about the feature. (deferred — internal module; docs land with the results UI.)Changes
Contributes to the experimentation results scorecard (v0.2). Pure stats module — no Django, ClickHouse or schema changes; the query, model and endpoints follow in stacked PRs.
VariantStats— per-variant sufficient statistics (n,sum,sum_squares) with derived mean and clamped unbiased variance; the only data the warehouse needs to return per metric × variant.compare_to_control(control, treatment)— relative lift with delta-method variance, Normal posterior under a flat prior: 95% credible interval andchance_to_win = P(lift > 0); direction flips for "lower is better" metrics belong to the payload builder. ReturnsNonewhen inference is undefined (an arm below two observations, or zero control mean); zero variance degenerates to certainty without dividing by zero.srm_p_value(observed, expected_shares)— chi-squared goodness-of-fit survival, exact for integer degrees of freedom using only the stdlib (erfcbase case + the incomplete-gamma recurrence; no scipy).Nonewhen not computable.How did you test this code?
pytest tests/unit/experimentation/— 265 passed;ruff+mypystrict clean.