Skip to content

feat: experiment defaults to a fixed relative MDE. #31025

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

Merged
merged 2 commits into from
Apr 10, 2025

Conversation

rodrigoi
Copy link
Contributor

@rodrigoi rodrigoi commented Apr 9, 2025

Important

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Problem

Following up on this comment from #30792

Just a side note for later: I think we can get rid of this whole function actually. It think this calculation tries to estimate an absolute MDE, but we should just default to 30% relative MDE. So no need for this logic. But that's another PR.
#30792 (comment)

Changes

We are removing getMinimumDetectableEffect, their tests and all usages in favor of a constant we'll use as default.

Does this work well for both Cloud and self-hosted?

How did you test this code?

pnpm --filter=@posthog/frontend jest frontend/src/scenes/experiments/experimentLogic.test.ts

@rodrigoi rodrigoi self-assigned this Apr 9, 2025
@rodrigoi rodrigoi requested a review from a team April 9, 2025 19:36
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

The PR removes the dynamic calculation of the Minimum Detectable Effect in favor of a fixed constant, simplifying the running time logic and related tests.

  • RunningTimeCalculatorLogic: Replaces dynamic MDE logic with the DEFAULT_MDE constant in /frontend/src/scenes/experiments/RunningTimeCalculator/runningTimeCalculatorLogic.tsx.
  • Utils Cleanup: Eliminates the getMinimumDetectableEffect function and its related types/logic in /frontend/src/scenes/experiments/utils.ts.
  • Test Adjustments: Removes redundant MDE test cases in /frontend/src/scenes/experiments/utils.test.ts.
  • Experiment Logic Update: Strips out dynamic MDE computation from /frontend/src/scenes/experiments/experimentLogic.tsx.

4 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@rodrigoi rodrigoi force-pushed the experiments/updating-to-relative-MDE branch from cb01d22 to 670d4ec Compare April 9, 2025 19:39
Copy link
Contributor

github-actions bot commented Apr 9, 2025

Size Change: -382 B (0%)

Total Size: 13.2 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 13.2 MB -382 B (0%)

compressed-size-action

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@rodrigoi rodrigoi marked this pull request as draft April 9, 2025 23:10
andehen
andehen previously approved these changes Apr 10, 2025
Copy link
Contributor

@andehen andehen left a comment

Choose a reason for hiding this comment

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

Looks good to me so far, I'll do a proper review once it's ready.

@andehen andehen self-requested a review April 10, 2025 14:26
@andehen andehen dismissed their stale review April 10, 2025 14:27

miss-click

@rodrigoi rodrigoi force-pushed the experiments/updating-to-relative-MDE branch from 4c42872 to 350c535 Compare April 10, 2025 18:17
@rodrigoi rodrigoi changed the title feature: removing MDE calculations in favor of a fixed relative MDE. feature: experiment defaults to a fixed relative MDE. Apr 10, 2025
@rodrigoi rodrigoi changed the title feature: experiment defaults to a fixed relative MDE. feat: experiment defaults to a fixed relative MDE. Apr 10, 2025
@rodrigoi rodrigoi marked this pull request as ready for review April 10, 2025 18:26
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR simplifies experiment design by replacing dynamic Minimum Detectable Effect (MDE) calculations with a fixed 30% relative value.

  • Added minimumSampleSizePerVariant calculation in experimentLogic.test.ts with significantly reduced sample size values (from thousands to tens)
  • Implemented variant count multiplication in sample size calculation in runningTimeCalculatorLogic.tsx to properly account for multivariate experiments
  • Removed all getMinimumDetectableEffect function references and related imports across the codebase
  • Updated test cases to reflect the new fixed MDE approach with adjusted expected values for running time calculations
  • Added constant DEFAULT_MDE = 30 in experimentLogic.tsx to replace the dynamic calculation

5 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

@andehen andehen left a comment

Choose a reason for hiding this comment

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

😍 Screenshot 2025-04-10 at 21 52 23

@rodrigoi rodrigoi merged commit 22ff9ff into master Apr 10, 2025
115 of 118 checks passed
@rodrigoi rodrigoi deleted the experiments/updating-to-relative-MDE branch April 10, 2025 20:32
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.

3 participants