/** * Quantile / IQR utilities for the extreme-value explainer. * * FROZEN for the executor agent: do not modify scoring logic here. * See docs/explain-data-worklog.md §1. */ /** Type-7 (linear interpolation) quantile of a pre-sorted ascending array. */ export declare function quantileSorted(sorted: number[], p: number): number; export interface IIqrOutlierResult { q1: number; q3: number; iqr: number; lowerFence: number; upperFence: number; /** indices into the ORIGINAL (unsorted) values array */ outlierIndices: number[]; } /** Tukey's fences: values beyond q1/q3 ± 1.5·IQR. */ export declare function detectIqrOutliers(values: number[], k?: number): IIqrOutlierResult; export type ISensitiveAggregator = 'sum' | 'mean' | 'stdev' | 'variance'; export declare function computeAggregate(values: number[], agg: ISensitiveAggregator): number; export interface IOutlierImpact { /** aggregate over all values */ aggregateAll: number; /** aggregate with outlier values removed */ aggregateWithout: number; /** relative change in the aggregate caused by the outliers, in [0, ∞) */ impact: number; } /** * How much do the outlier rows distort the aggregate the user is looking at? * `impact` is relative to the full aggregate; when the full aggregate is ~0, * the change is scaled by the values' dispersion instead so the ratio stays * meaningful. */ export declare function outlierImpact(values: number[], outlierIndices: number[], agg: ISensitiveAggregator): IOutlierImpact;