/** * Statistical kernel for the Explain Data module. * * FROZEN for the executor agent: do not modify scoring logic here. * See docs/explain-data-worklog.md §1. */ /** * Laplace-smooth a non-negative mass vector into a probability vector. * alpha adds pseudo-mass to every category so small samples do not * produce spuriously extreme distributions. */ export declare function laplaceSmooth(mass: number[], alpha?: number): number[]; /** * Jensen–Shannon divergence (base 2) between two aligned probability vectors. * Zero-probability categories contribute by definition (0·log0 = 0; the * non-zero side contributes 0.5·p). Bounded in [0, 1]. */ export declare function jsDivergence(p: number[], q: number[]): number; /** * Jensen–Shannon distance: sqrt of the divergence. A proper metric, * bounded in [0, 1] and comparable across candidate dimensions of * different cardinalities. */ export declare function jsDistance(p: number[], q: number[]): number; /** * Element-wise `total − part`, clamped at 0 (guards float noise). * Used to derive the siblings distribution from the all-marks totals * without an extra query; valid for additive masses (counts, sums). */ export declare function subtractMass(total: number[], part: number[]): number[]; /** log Γ(x) via Lanczos approximation, x > 0. */ export declare function logGamma(x: number): number; /** * Upper-tail probability of the chi-square distribution: * P(X ≥ x) for X ~ χ²(df). */ export declare function chiSquareUpperTail(x: number, df: number): number; /** * G-test of goodness of fit: are the observed category counts consistent * with the expected probabilities? * * @param observed raw counts for the selected mark, aligned with expectedProbs * @param expectedProbs probability vector (e.g. smoothed sibling shares) * @returns p-value; small p ⇒ the mark's composition differs significantly */ export declare function gTestPValue(observed: number[], expectedProbs: number[]): number;