@tangle-network/agent-eval 2.0.16 → 2.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/analyst/index.d.ts +20 -2
- package/dist/analyst/index.d.ts.map +1 -1
- package/dist/analyst/index.js +3 -3
- package/dist/app-grade/index.d.ts +1 -1
- package/dist/{benchmark-command-DgR1i30h.js → benchmark-command-CZbrh9bS.js} +27 -8
- package/dist/benchmark-command-CZbrh9bS.js.map +1 -0
- package/dist/benchmarks/index.d.ts +13 -0
- package/dist/benchmarks/index.d.ts.map +1 -1
- package/dist/benchmarks/index.js +100 -11
- package/dist/benchmarks/index.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/dspy-rlm-engine-DFgGrKzg.js +1613 -0
- package/dist/dspy-rlm-engine-DFgGrKzg.js.map +1 -0
- package/dist/experiment/index.d.ts +74 -5
- package/dist/experiment/index.d.ts.map +1 -1
- package/dist/experiment/index.js +196 -13
- package/dist/experiment/index.js.map +1 -1
- package/dist/{findings-store-Drnjid7m.js → findings-store-DcBkRLDk.js} +2 -2
- package/dist/{findings-store-Drnjid7m.js.map → findings-store-DcBkRLDk.js.map} +1 -1
- package/dist/{index-B8bNGE_2.d.ts → index-4khf0Q7g.d.ts} +236 -2
- package/dist/index-4khf0Q7g.d.ts.map +1 -0
- package/dist/{index-BkWxigto.d.ts → index-Cq_5SLfF.d.ts} +6 -236
- package/dist/index-Cq_5SLfF.d.ts.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -1087
- package/dist/index.js.map +1 -1
- package/dist/openapi.json +1 -1
- package/dist/wire/index.d.ts +2 -2
- package/docs/experiment.md +31 -1
- package/docs/trace-contracts.md +23 -0
- package/package.json +1 -1
- package/dist/benchmark-command-DgR1i30h.js.map +0 -1
- package/dist/dspy-rlm-engine-CR5MSL2k.js +0 -463
- package/dist/dspy-rlm-engine-CR5MSL2k.js.map +0 -1
- package/dist/index-B8bNGE_2.d.ts.map +0 -1
- package/dist/index-BkWxigto.d.ts.map +0 -1
package/dist/experiment/index.js
CHANGED
|
@@ -965,6 +965,8 @@ function joinProspectiveCanaryReceipts(input) {
|
|
|
965
965
|
if (utc(bill.recordedAt, "billing recordedAt") < assignedAt) throw new ValidationError("prospective canary: billing precedes assignment");
|
|
966
966
|
if (bill.settlement === "settled") {
|
|
967
967
|
if (bill.billedCostUsd === null || !Number.isFinite(bill.billedCostUsd) || bill.billedCostUsd < 0) throw new ValidationError("prospective canary: settled billing needs nonnegative actual cost");
|
|
968
|
+
} else if (bill.settlement === "subscription") {
|
|
969
|
+
if (bill.billedCostUsd !== null) throw new ValidationError("prospective canary: subscription billing has no dollar figure");
|
|
968
970
|
} else if (bill.settlement !== "unknown" || bill.billedCostUsd !== null) throw new ValidationError("prospective canary: unknown billing cost must stay null");
|
|
969
971
|
if (execution && uniqueIds(bill.providerCallIds, "billing call").join("\0") !== uniqueIds(execution.providerCallIds, "execution call").join("\0")) throw new ValidationError("prospective canary: provider-call billing join is incomplete");
|
|
970
972
|
}
|
|
@@ -977,6 +979,7 @@ function joinProspectiveCanaryReceipts(input) {
|
|
|
977
979
|
outcomeSourceId: outcome?.outcomeSourceId ?? null,
|
|
978
980
|
billedCostUsd: bill?.settlement === "settled" ? bill.billedCostUsd : null,
|
|
979
981
|
billingSourceId: bill?.billingSourceId ?? null,
|
|
982
|
+
...bill?.settlement === "subscription" ? { billingBasis: "subscription" } : {},
|
|
980
983
|
traceSourceId: execution?.traceSourceId ?? null,
|
|
981
984
|
noExecutionSourceId: execution?.noExecutionSourceId ?? null,
|
|
982
985
|
servedProfileDigest: execution?.servedProfileDigest ?? null,
|
|
@@ -1027,6 +1030,7 @@ function randomizedCanaryObservationDigest(rows) {
|
|
|
1027
1030
|
outcomeSourceId: row.outcomeSourceId,
|
|
1028
1031
|
billedCostUsd: row.billedCostUsd,
|
|
1029
1032
|
billingSourceId: row.billingSourceId,
|
|
1033
|
+
billingBasis: row.billingBasis ?? "measured",
|
|
1030
1034
|
traceSourceId: row.traceSourceId,
|
|
1031
1035
|
noExecutionSourceId: row.noExecutionSourceId,
|
|
1032
1036
|
servedProfileDigest: row.servedProfileDigest,
|
|
@@ -1054,9 +1058,14 @@ function validateRule(rule) {
|
|
|
1054
1058
|
]) nonEmpty(rule[field], field);
|
|
1055
1059
|
if (!Number.isSafeInteger(rule.confirmatoryFamilySize) || rule.confirmatoryFamilySize < 1 || rule.confirmatoryFamilySize > 1e3) throw new ValidationError("randomized canary: confirmatoryFamilySize must be in [1, 1000]");
|
|
1056
1060
|
if (!Number.isSafeInteger(rule.confirmatoryIndex) || rule.confirmatoryIndex < 1 || rule.confirmatoryIndex > rule.confirmatoryFamilySize) throw new ValidationError("randomized canary: confirmatoryIndex must name a reserved family slot");
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1061
|
+
const clustersFor = {
|
|
1062
|
+
customer: ["customer"],
|
|
1063
|
+
session: ["session", "customer"],
|
|
1064
|
+
task: ["task", "repository"]
|
|
1065
|
+
};
|
|
1066
|
+
const allowed = Object.hasOwn(clustersFor, rule.assignmentUnit) ? clustersFor[rule.assignmentUnit] : void 0;
|
|
1067
|
+
if (allowed === void 0) throw new ValidationError("randomized canary: assignmentUnit must be customer, session or task");
|
|
1068
|
+
if (!allowed.includes(rule.clusterUnit)) throw new ValidationError(`randomized canary: ${rule.assignmentUnit} assignments must cluster by ${allowed.join(" or ")}`);
|
|
1060
1069
|
if (rule.stoppingRule !== "fixed-time") throw new ValidationError("randomized canary: only fixed-time stopping is supported");
|
|
1061
1070
|
if (!Number.isFinite(Date.parse(rule.analysisCutoff)) || !rule.analysisCutoff.endsWith("Z")) throw new ValidationError("randomized canary: analysisCutoff must be a UTC timestamp");
|
|
1062
1071
|
if (!Number.isSafeInteger(rule.outcomeMaturityMs) || rule.outcomeMaturityMs < 0) throw new ValidationError("randomized canary: outcomeMaturityMs must be a nonnegative integer");
|
|
@@ -1120,17 +1129,24 @@ function checkObservationRow(row, index, tally) {
|
|
|
1120
1129
|
if (row.outcomeSourceId === null) {
|
|
1121
1130
|
if (row.checkedOutcome !== null) throw new ValidationError(`randomized canary: assignment ${index} has an outcome without its source`);
|
|
1122
1131
|
} else nonEmpty(row.outcomeSourceId, `assignment ${index} outcome source id`);
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
if (
|
|
1126
|
-
if (row.billedCostUsd !== null) throw new ValidationError(`randomized canary: assignment ${index} has
|
|
1127
|
-
|
|
1132
|
+
const basis = row.billingBasis ?? "measured";
|
|
1133
|
+
if (basis !== "measured" && basis !== "subscription") throw new ValidationError(`randomized canary: assignment ${index} billing basis must be measured or subscription`);
|
|
1134
|
+
if (basis === "subscription") {
|
|
1135
|
+
if (row.billedCostUsd !== null || row.billingSourceId === null) throw new ValidationError(`randomized canary: assignment ${index} subscription billing has a seat record and no dollar figure`);
|
|
1136
|
+
nonEmpty(row.billingSourceId, `assignment ${index} billing source id`);
|
|
1137
|
+
} else {
|
|
1138
|
+
if (row.billedCostUsd === null) tally.missingBilling++;
|
|
1139
|
+
else if (!Number.isFinite(row.billedCostUsd) || row.billedCostUsd < 0) throw new ValidationError(`randomized canary: assignment ${index} billed cost must be nonnegative`);
|
|
1140
|
+
if (row.billingSourceId === null) {
|
|
1141
|
+
if (row.billedCostUsd !== null) throw new ValidationError(`randomized canary: assignment ${index} has billed cost without its source`);
|
|
1142
|
+
} else nonEmpty(row.billingSourceId, `assignment ${index} billing source id`);
|
|
1143
|
+
}
|
|
1128
1144
|
if (row.turns === null) tally.missingTurns++;
|
|
1129
1145
|
else if (!Number.isSafeInteger(row.turns) || row.turns < 0) throw new ValidationError(`randomized canary: assignment ${index} turns must be a nonnegative integer`);
|
|
1130
1146
|
if (row.traceSourceId !== null) nonEmpty(row.traceSourceId, `assignment ${index} trace source id`);
|
|
1131
1147
|
if (row.noExecutionSourceId !== null) nonEmpty(row.noExecutionSourceId, `assignment ${index} no-execution source id`);
|
|
1132
1148
|
if (row.traceSourceId !== null && row.noExecutionSourceId !== null) throw new ValidationError(`randomized canary: assignment ${index} has conflicting trace and no-execution receipts`);
|
|
1133
|
-
const noExecution = row.noExecutionSourceId !== null && row.turns === 0 && row.billedCostUsd === 0 && row.checkedOutcome === 0;
|
|
1149
|
+
const noExecution = row.noExecutionSourceId !== null && row.turns === 0 && (basis === "subscription" || row.billedCostUsd === 0) && row.checkedOutcome === 0;
|
|
1134
1150
|
if (row.traceSourceId === null && !noExecution) tally.missingTraces++;
|
|
1135
1151
|
for (const field of [
|
|
1136
1152
|
"servedProfileDigest",
|
|
@@ -1179,9 +1195,11 @@ function baseDecision(sealed, cohort, rowCount, tally) {
|
|
|
1179
1195
|
if (sealed.rule.assignmentUnit === sealed.rule.clusterUnit) {
|
|
1180
1196
|
for (const [clusterId, bucket] of clusters) if (bucket.length !== 1) throw new ValidationError(`randomized canary: ${sealed.rule.assignmentUnit} cluster '${clusterId}' has multiple assignments`);
|
|
1181
1197
|
}
|
|
1198
|
+
const subscription = (row) => row.billingBasis === "subscription";
|
|
1182
1199
|
const coverage = (arm) => ({
|
|
1183
1200
|
checkedOutcomes: arms[arm].filter((row) => row.checkedOutcome !== null).length,
|
|
1184
|
-
billedAssignments: arms[arm].filter((row) => row.billedCostUsd !== null).length,
|
|
1201
|
+
billedAssignments: arms[arm].filter((row) => row.billedCostUsd !== null || subscription(row)).length,
|
|
1202
|
+
subscriptionAssignments: arms[arm].filter(subscription).length,
|
|
1185
1203
|
turnReceipts: arms[arm].filter((row) => row.turns !== null).length,
|
|
1186
1204
|
traceReceipts: arms[arm].filter((row) => row.traceSourceId !== null).length
|
|
1187
1205
|
});
|
|
@@ -1189,6 +1207,7 @@ function baseDecision(sealed, cohort, rowCount, tally) {
|
|
|
1189
1207
|
control: coverage("control"),
|
|
1190
1208
|
candidate: coverage("candidate")
|
|
1191
1209
|
};
|
|
1210
|
+
const dollarsKnown = (arm) => armCoverage[arm].billedAssignments === arms[arm].length && armCoverage[arm].subscriptionAssignments === 0;
|
|
1192
1211
|
const sum = (arm, field) => arms[arm].reduce((total, row) => total + (row[field] ?? 0), 0);
|
|
1193
1212
|
const n0 = arms.control.length;
|
|
1194
1213
|
const n1 = arms.candidate.length;
|
|
@@ -1224,8 +1243,8 @@ function baseDecision(sealed, cohort, rowCount, tally) {
|
|
|
1224
1243
|
familyAdjustedInterval: null,
|
|
1225
1244
|
familywisePass: false,
|
|
1226
1245
|
unadjustedPValue: null,
|
|
1227
|
-
controlBilledCostUsd:
|
|
1228
|
-
candidateBilledCostUsd:
|
|
1246
|
+
controlBilledCostUsd: dollarsKnown("control") ? sum("control", "billedCostUsd") : null,
|
|
1247
|
+
candidateBilledCostUsd: dollarsKnown("candidate") ? sum("candidate", "billedCostUsd") : null,
|
|
1229
1248
|
controlTurns: armCoverage.control.turnReceipts === n0 ? sum("control", "turns") : null,
|
|
1230
1249
|
candidateTurns: armCoverage.candidate.turnReceipts === n1 ? sum("candidate", "turns") : null,
|
|
1231
1250
|
refusal: null,
|
|
@@ -1279,6 +1298,13 @@ function estimateRiskDifference(rule, tally, result) {
|
|
|
1279
1298
|
/** Apply one registered analysis to the entire frozen assignment roster. */
|
|
1280
1299
|
function decideRandomizedCanary(sealed, cohort, rows, verifyCohort) {
|
|
1281
1300
|
verifyCohortEvidence(sealed, cohort, rows, verifyCohort);
|
|
1301
|
+
return analyzeVerifiedCanaryRows(sealed, cohort, rows);
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* The registered analysis on rows whose cohort evidence is already verified. Internal: the power
|
|
1305
|
+
* simulation runs this same estimator, so its refusals and intervals are the decision's own.
|
|
1306
|
+
*/
|
|
1307
|
+
function analyzeVerifiedCanaryRows(sealed, cohort, rows) {
|
|
1282
1308
|
const tally = tallyObservations(sealed.rule, rows);
|
|
1283
1309
|
const result = baseDecision(sealed, cohort, rows.length, tally);
|
|
1284
1310
|
const refusal = refusalReason(sealed.rule, tally, result);
|
|
@@ -1289,6 +1315,163 @@ function decideRandomizedCanary(sealed, cohort, rows, verifyCohort) {
|
|
|
1289
1315
|
estimateRiskDifference(sealed.rule, tally, result);
|
|
1290
1316
|
return result;
|
|
1291
1317
|
}
|
|
1292
|
-
|
|
1318
|
+
// src/experiment/randomized-canary-power.ts
|
|
1319
|
+
/**
|
|
1320
|
+
* Design-time power for the randomized served canary, computed with the canary's own estimator.
|
|
1321
|
+
*
|
|
1322
|
+
* `clusteredPower` simulates a paired design: each row is a within-unit contrast. A served canary
|
|
1323
|
+
* is unpaired: each assignment runs in one arm, outcomes are binary, and the decision is a
|
|
1324
|
+
* cluster-robust risk difference with refusals for too few or dominant clusters. This simulation
|
|
1325
|
+
* draws assignments from a declared cluster structure, randomizes each one to an arm, draws its
|
|
1326
|
+
* outcome, and runs the same analysis `decideRandomizedCanary` runs, so the power it reports
|
|
1327
|
+
* includes every refusal the decision would make.
|
|
1328
|
+
*
|
|
1329
|
+
* Outcome model: each cluster has its own success propensity, drawn from a Beta distribution
|
|
1330
|
+
* with mean `controlRate` and intracluster correlation `intraclusterCorrelation`. A candidate
|
|
1331
|
+
* assignment succeeds with that propensity plus the lift, clipped to [0, 1].
|
|
1332
|
+
*/
|
|
1333
|
+
function check(condition, message) {
|
|
1334
|
+
if (!condition) throw new ValidationError(`randomized canary power: ${message}`);
|
|
1335
|
+
}
|
|
1336
|
+
/** Standard normal draw (Box-Muller). */
|
|
1337
|
+
function normal(rng) {
|
|
1338
|
+
const u = Math.max(rng(), Number.MIN_VALUE);
|
|
1339
|
+
return Math.sqrt(-2 * Math.log(u)) * Math.cos(2 * Math.PI * rng());
|
|
1340
|
+
}
|
|
1341
|
+
/** Gamma(shape, 1) draw (Marsaglia-Tsang; boosted below shape 1). */
|
|
1342
|
+
function gamma(shape, rng) {
|
|
1343
|
+
if (shape < 1) return gamma(shape + 1, rng) * rng() ** (1 / shape);
|
|
1344
|
+
const d = shape - 1 / 3;
|
|
1345
|
+
const c = 1 / Math.sqrt(9 * d);
|
|
1346
|
+
for (;;) {
|
|
1347
|
+
const x = normal(rng);
|
|
1348
|
+
const v = (1 + c * x) ** 3;
|
|
1349
|
+
if (v <= 0) continue;
|
|
1350
|
+
const u = rng();
|
|
1351
|
+
if (Math.log(u) < .5 * x * x + d - d * v + d * Math.log(v)) return d * v;
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
function propensity(mean, icc, rng) {
|
|
1355
|
+
if (icc === 0) return mean;
|
|
1356
|
+
const total = 1 / icc - 1;
|
|
1357
|
+
const a = gamma(mean * total, rng);
|
|
1358
|
+
return a / (a + gamma((1 - mean) * total, rng));
|
|
1359
|
+
}
|
|
1360
|
+
const COHORT = {
|
|
1361
|
+
protocolDigest: "simulated",
|
|
1362
|
+
assignmentRosterDigest: "simulated",
|
|
1363
|
+
assignmentCount: 0,
|
|
1364
|
+
assignmentLedgerSourceId: "simulated",
|
|
1365
|
+
assignmentLedgerTipDigest: "simulated",
|
|
1366
|
+
outcomeLedgerSourceId: "simulated",
|
|
1367
|
+
billingLedgerSourceId: "simulated",
|
|
1368
|
+
observationSnapshotDigest: "simulated",
|
|
1369
|
+
observationFrozenAt: "1970-01-01T00:00:00Z",
|
|
1370
|
+
authorityId: "simulated",
|
|
1371
|
+
attestationSourceId: "simulated",
|
|
1372
|
+
closedAt: "1970-01-01T00:00:00Z",
|
|
1373
|
+
attestedAt: "1970-01-01T00:00:00Z"
|
|
1374
|
+
};
|
|
1375
|
+
/** Simulate the canary decision under a declared cluster structure and outcome model. */
|
|
1376
|
+
function randomizedCanaryPower(options) {
|
|
1377
|
+
const { clusterSizes, controlRate, intraclusterCorrelation: icc, lifts, candidateShare = .5, minimumLift = 0, minimumClusters = 40, confirmatoryFamilySize = 1, targetPower = .8, trials = 2e3, seed } = options;
|
|
1378
|
+
check(clusterSizes.length > 0 && clusterSizes.every((n) => Number.isSafeInteger(n) && n >= 1), "clusterSizes must be positive integers");
|
|
1379
|
+
check(controlRate > 0 && controlRate < 1, "controlRate must be in (0, 1)");
|
|
1380
|
+
check(icc >= 0 && icc < 1, "intraclusterCorrelation must be in [0, 1)");
|
|
1381
|
+
check(lifts.length > 0 && lifts.every((lift) => lift >= 0 && lift < 1), "lifts must be in [0, 1)");
|
|
1382
|
+
check(candidateShare > 0 && candidateShare < 1, "candidateShare must be in (0, 1)");
|
|
1383
|
+
check(targetPower > 0 && targetPower < 1, "targetPower must be in (0, 1)");
|
|
1384
|
+
check(Number.isSafeInteger(trials) && trials >= 1, "trials must be a positive integer");
|
|
1385
|
+
check(Number.isSafeInteger(seed), "seed must be an integer");
|
|
1386
|
+
const sealed = sealRandomizedCanaryRule({
|
|
1387
|
+
experimentId: "power",
|
|
1388
|
+
populationId: "power",
|
|
1389
|
+
eligibilityRuleDigest: "sha256:simulated",
|
|
1390
|
+
randomizationSourceId: "power",
|
|
1391
|
+
assignmentLedgerAuthorityId: "power",
|
|
1392
|
+
controlProfileDigest: "control",
|
|
1393
|
+
candidateProfileDigest: "candidate",
|
|
1394
|
+
servedCodeRevisionDigest: "served",
|
|
1395
|
+
outcomeCheckerDigest: "checker",
|
|
1396
|
+
confirmatoryFamilyId: "power",
|
|
1397
|
+
confirmatoryFamilySize,
|
|
1398
|
+
confirmatoryIndex: 1,
|
|
1399
|
+
familyReservationSourceId: "power",
|
|
1400
|
+
assignmentUnit: "task",
|
|
1401
|
+
clusterUnit: "repository",
|
|
1402
|
+
stoppingRule: "fixed-time",
|
|
1403
|
+
analysisCutoff: "1970-01-01T00:00:00Z",
|
|
1404
|
+
outcomeMaturityMs: 0,
|
|
1405
|
+
minimumLift,
|
|
1406
|
+
minimumClusters
|
|
1407
|
+
});
|
|
1408
|
+
const curve = lifts.map((lift, liftIndex) => {
|
|
1409
|
+
const rng = mulberry32(seed + Math.imul(liftIndex + 1, 2654435761) >>> 0);
|
|
1410
|
+
const refusals = {
|
|
1411
|
+
"missing-evidence": 0,
|
|
1412
|
+
"missing-trace": 0,
|
|
1413
|
+
"execution-drift": 0,
|
|
1414
|
+
"insufficient-clusters": 0,
|
|
1415
|
+
"dominant-cluster": 0,
|
|
1416
|
+
"zero-variance": 0
|
|
1417
|
+
};
|
|
1418
|
+
let passes = 0;
|
|
1419
|
+
const widths = [];
|
|
1420
|
+
for (let trial = 0; trial < trials; trial++) {
|
|
1421
|
+
const rows = [];
|
|
1422
|
+
for (const [cluster, size] of clusterSizes.entries()) {
|
|
1423
|
+
const q = propensity(controlRate, icc, rng);
|
|
1424
|
+
for (let k = 0; k < size; k++) {
|
|
1425
|
+
const arm = rng() < candidateShare ? "candidate" : "control";
|
|
1426
|
+
const p = arm === "candidate" ? Math.min(1, q + lift) : q;
|
|
1427
|
+
const id = `${cluster}-${k}`;
|
|
1428
|
+
rows.push({
|
|
1429
|
+
assignmentId: id,
|
|
1430
|
+
assignmentSourceId: id,
|
|
1431
|
+
clusterId: String(cluster),
|
|
1432
|
+
arm,
|
|
1433
|
+
checkedOutcome: rng() < p ? 1 : 0,
|
|
1434
|
+
outcomeSourceId: "simulated",
|
|
1435
|
+
billedCostUsd: null,
|
|
1436
|
+
billingSourceId: "simulated",
|
|
1437
|
+
billingBasis: "subscription",
|
|
1438
|
+
traceSourceId: "simulated",
|
|
1439
|
+
noExecutionSourceId: null,
|
|
1440
|
+
servedProfileDigest: arm === "candidate" ? "candidate" : "control",
|
|
1441
|
+
servedCodeRevisionDigest: "served",
|
|
1442
|
+
outcomeCheckerDigest: "checker",
|
|
1443
|
+
turns: 1
|
|
1444
|
+
});
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
const decision = analyzeVerifiedCanaryRows(sealed, COHORT, rows);
|
|
1448
|
+
if (decision.refusal !== null) refusals[decision.refusal]++;
|
|
1449
|
+
if (decision.successCriterionMet) passes++;
|
|
1450
|
+
if (decision.nominal95Interval !== null) widths.push(decision.nominal95Interval.high - decision.nominal95Interval.low);
|
|
1451
|
+
}
|
|
1452
|
+
widths.sort((a, b) => a - b);
|
|
1453
|
+
return {
|
|
1454
|
+
lift,
|
|
1455
|
+
power: passes / trials,
|
|
1456
|
+
refusals: Object.fromEntries(Object.entries(refusals).map(([reason, count]) => [reason, count / trials])),
|
|
1457
|
+
medianIntervalWidth: widths.length === 0 ? null : widths[Math.floor(widths.length / 2)]
|
|
1458
|
+
};
|
|
1459
|
+
});
|
|
1460
|
+
const detectable = curve.filter((point) => point.power >= targetPower).map((point) => point.lift).sort((a, b) => a - b)[0];
|
|
1461
|
+
return {
|
|
1462
|
+
clusters: clusterSizes.length,
|
|
1463
|
+
assignments: clusterSizes.reduce((total, n) => total + n, 0),
|
|
1464
|
+
controlRate,
|
|
1465
|
+
intraclusterCorrelation: icc,
|
|
1466
|
+
candidateShare,
|
|
1467
|
+
minimumLift,
|
|
1468
|
+
targetPower,
|
|
1469
|
+
trials,
|
|
1470
|
+
seed,
|
|
1471
|
+
curve,
|
|
1472
|
+
detectableLift: detectable ?? null
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1475
|
+
export { BOOTSTRAP_GATE_MIN_N, EVIDENCE_STATES, FinalEvidenceConflictError, FinalEvidenceError, amendExperiment, assertDesignAdequate, assertMatchedBudgets, benjaminiHochberg, bonferroni, buildEvidenceVector, buildFunnel, clusteredPower, comparePairedArms, composeFunnels, computeInterval, createCampaignEvidenceReceipt, createEvidenceReceipt, decideRandomizedCanary, defineEvaluationClaim, defineExperiment, eProcess, evaluateCondition, evaluatePowerFloorGate, evidenceRegistryRecordSchema, executeAdmissionRule, executeDecisionRule, hashJson, heldoutSignificance, holm, isIndependentEvidence, joinProspectiveCanaryReceipts, manifestContentDigest, mcnemar, mcnemarPower, mcnemarRequiredN, mulberry32, openFinalEvidenceLedger, openSealedExperiment, pairArms, pairHoldout, pairRunRecords, pairedBootstrap, pairedEvalueSequence, pairedMde, pairedRiskDifference, pairedRiskDifferenceExact, pairedRiskDifferenceScore, paretoPolicy, paretoSignificanceGate, powerPreflight, randomizedCanaryObservationDigest, randomizedCanaryPower, randomizedCanaryRosterDigest, readField, renderFunnelTable, requiredPairedSampleSize, requiredSampleSize, sealExperiment, sealMeasureValidityPlan, sealRandomizedCanaryRule, sequentialDecide, sequentialPairedGate, signManifest, summarizeEvaluationUnits, verifyEvidenceReceipt, verifyManifest, verifyMatchedBudgets, verifyMeasureValidityPlan, verifySealedExperiment, wilson };
|
|
1293
1476
|
|
|
1294
1477
|
//# sourceMappingURL=index.js.map
|