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

[stats] Migrate bayesian engine to gaussian effect model; unlock priors + CUPED #2406

Merged
merged 29 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fe6b831
first pass at simulation class
Apr 4, 2024
012e9dc
simulation class v1
Apr 5, 2024
53f4248
Update sim study approach
lukesonnet Apr 5, 2024
fc19111
Fix mean
lukesonnet Apr 8, 2024
a1201e7
Expose full result
lukesonnet Apr 10, 2024
55bcb98
Replace complex bayesian machinery with simpler model
lukesonnet Apr 10, 2024
10dac5e
Merge remote-tracking branch 'origin/main' into ls/bayesian-revamp
lukesonnet Apr 10, 2024
a2cc3b2
Fix tests; improper prior flag
lukesonnet Apr 10, 2024
a2523d7
Use ntests
lukesonnet Apr 11, 2024
ed0476d
Merge branch 'sonnet-smith-sim-study' into ls/bayesian-revamp
lukesonnet Apr 11, 2024
7d0ef0f
Update different prior types and rescaling
lukesonnet Apr 18, 2024
4b0c7ed
Merge remote-tracking branch 'origin/main' into ls/bayesian-revamp
lukesonnet Apr 18, 2024
0559f3c
Fix prior config
lukesonnet Apr 18, 2024
d7dd829
Fix tests
lukesonnet Apr 18, 2024
a8be22a
Retool how risk is calculated
lukesonnet Apr 22, 2024
9e6b850
Add risk type
lukesonnet Apr 22, 2024
2d889cb
Fix tests
lukesonnet Apr 22, 2024
7144741
Merge remote-tracking branch 'origin/main' into ls/bayesian-revamp
lukesonnet Apr 23, 2024
e79c64d
Ensure risk is flipped
lukesonnet Apr 23, 2024
d0bca1f
Add risk type
lukesonnet Apr 23, 2024
fafa79f
Fix test
lukesonnet Apr 23, 2024
a8fd730
Luke's comments; renaming
lukesonnet Apr 24, 2024
c5321f2
Merge remote-tracking branch 'origin/main' into ls/bayesian-revamp
lukesonnet May 2, 2024
083abd5
[stats] Add ability to specify effect priors (#2407)
lukesonnet May 10, 2024
50bcd12
Change default; comments
lukesonnet May 10, 2024
bc41d65
Merge remote-tracking branch 'origin/main' into ls/bayesian-revamp
lukesonnet May 10, 2024
191baf7
Fix tests
lukesonnet May 10, 2024
4e64144
Docs
lukesonnet May 10, 2024
25a9488
Docs update
lukesonnet May 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/back-end/types/experiment-snapshot.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from "../src/services/stats";
import { QueryLanguage } from "./datasource";
import { MetricInterface, MetricStats } from "./metric";
import { DifferenceType, StatsEngine } from "./stats";
import { DifferenceType, RiskType, StatsEngine } from "./stats";
import { Queries } from "./query";
import {
ExperimentReportResultDimension,
Expand All @@ -24,6 +24,7 @@ export interface SnapshotMetric {
ciAdjusted?: [number, number];
expected?: number;
risk?: [number, number];
riskType?: RiskType;
stats?: MetricStats;
pValue?: number;
pValueAdjusted?: number;
Expand Down
2 changes: 2 additions & 0 deletions packages/back-end/types/stats.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type PValueCorrection = null | "benjamini-hochberg" | "holm-bonferroni";

export type DifferenceType = "relative" | "absolute" | "scaled";

export type RiskType = "relative" | "absolute";
interface BaseVariationResponse {
cr: number;
value: number;
Expand All @@ -25,6 +26,7 @@ interface BaseVariationResponse {
interface BayesianVariationResponse extends BaseVariationResponse {
chanceToWin?: number;
risk?: [number, number];
riskType?: RiskType;
}

interface FrequentistVariationResponse extends BaseVariationResponse {
Expand Down
14 changes: 12 additions & 2 deletions packages/front-end/services/experiments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,18 @@ export function getRisk(
// separate CR because sometimes "baseline" above is the variation
baselineCR: number
): { risk: number; relativeRisk: number; showRisk: boolean } {
const risk = stats.risk?.[1] ?? 0;
const relativeRisk = baselineCR ? risk / baselineCR : 0;
const statsRisk = stats.risk?.[1] ?? 0;
let risk: number;
let relativeRisk: number;
if (stats.riskType === "relative") {
risk = statsRisk * baselineCR;
relativeRisk = statsRisk;
} else {
// otherwise it is absolute, including legacy snapshots
// that were missing `riskType` field
risk = statsRisk;
relativeRisk = baselineCR ? statsRisk / baselineCR : 0;
}
const showRisk =
baseline.cr > 0 &&
hasEnoughData(baseline, stats, metric, metricDefaults) &&
Expand Down
143 changes: 0 additions & 143 deletions packages/stats/gbstats/bayesian/dists.py

This file was deleted.

92 changes: 0 additions & 92 deletions packages/stats/gbstats/bayesian/orthogonal.py

This file was deleted.

Loading
Loading