import type { TaskClass } from "./types.ts"; /** * A point estimate plus its 95% Wilson-score confidence interval. * * - `mean`: best-estimate success probability in [0, 1]. * - `lo95` / `hi95`: 95% Wilson-score interval bounds in [0, 1]. * - `n`: number of evaluation trials backing the estimate. When the * measurement file is missing this equals `PRIOR_N` (see below) so * callers can detect the fallback case. */ export interface QualityWithCI { mean: number; lo95: number; hi95: number; n: number; } /** * Synthetic trial count assigned to a fallback-prior cell so that the CI * is well-defined. Chosen at 10 trials, which yields a wide CI (~+/-0.3 * for p=0.5) — that's correct behaviour: the prior should be treated as * weak evidence, and a caller routing on `lo95` will be appropriately * conservative until real measurements land. */ export declare const PRIOR_N = 10; /** * Wilson score 95% confidence interval for a binomial proportion. * * Reference: Wilson, E. B. (1927). "Probable inference, the law of * succession, and statistical inference." JASA 22(158): 209-212. * * Why Wilson over Wald: Wald (the textbook normal approximation, p̂ ± * z*sqrt(p̂(1-p̂)/n)) collapses to the empty interval when p̂ ∈ {0, 1} * and underestimates uncertainty for small n. Wilson is well-defined at * the boundary, has better coverage at small n, and is the recommended * default for binomial CIs in modern stats texts (e.g. Agresti & Coull, * 1998 — "Approximate is better than 'exact' for interval estimation of * binomial proportions"). * * Inputs: * - `successes`: integer in [0, trials]. * - `trials`: positive integer. * * Returns the (lo, hi) tuple clamped to [0, 1]. Pure function. */ export declare function wilsonScore95(successes: number, trials: number): { lo: number; hi: number; }; /** * Test-only hook: clears the memoized quality table so the next lookup * re-reads disk. Mirrors `__resetCalibrationCacheForTest` in `cost.ts`. * Not part of the public API surface but intentionally exported with the * `__`-prefix convention so tests can reach for it explicitly. */ export declare const __resetQualityCacheForTest: () => void; /** * Return the expected quality for `(taskClass, modelId)` as a point estimate * in [0, 1]. * * Backward-compatible signature: matches `quality_prior.predictQuality` so * the router doesn't need to change. The mean comes from * `predictQualityWithCI` — callers wanting uncertainty should use that * function directly. * * Unknown models receive `DEFAULT_QUALITY = 0.5`. */ export declare function predictQuality(taskClass: TaskClass, modelId: string): number; /** * Return the expected quality for `(taskClass, modelId)` with a 95% * Wilson-score confidence interval. * * - `mean` is `successes / trials`. * - `lo95` / `hi95` is the Wilson score interval at the 95% level. * - `n` is the trial count (real for measured cells, `PRIOR_N` for the * seeded prior fallback). * * Unknown (taskClass, modelId) pairs return a uniform-prior estimate: * `{ mean: 0.5, lo95, hi95, n: PRIOR_N }` * where the CI is the Wilson 95% interval for 5 successes in 10 trials — * intentionally wide to reflect that no data backs the estimate. */ export declare function predictQualityWithCI(taskClass: TaskClass, modelId: string): QualityWithCI; /** * Introspection helper. Returns whether the predictor is currently serving * measurements or the fallback prior, and the metadata of the loaded file. * Useful for the CLI's `route --debug` output and for the paper's * reproducibility appendix. */ export declare function getQualitySourceInfo(): { source: "measured" | "prior"; loadedFrom?: string; generatedAt?: string; }; //# sourceMappingURL=quality_predictor.d.ts.map