import { type DuckDBLimits } from "#parquet/duckdb"; import { type SplitRetention } from "#utils/retention"; import { type CountryHoldout } from "#utils/split"; /** * The span tags that identify a place. */ export type HoldoutSpanTag = "region" | "locality"; /** * One folded country surface stored as a `tag` span, with the rows that have it on * each side of the split, in all and among rows with no postcode span. */ export interface HoldoutSpanCount { country: string; tag: HoldoutSpanTag; surface: string; trainRows: number; /** * The part of `trainRows` the retention table keeps in train (HOLDOUT_AND_EVALUATION section 5.1). */ retainedTrainRows: number; heldOutRows: number; trainRowsWithoutPostcode: number; heldOutRowsWithoutPostcode: number; } /** * The train rows of one country whose first postcode span begins with one declared prefix. */ export interface HoldoutPostcodeCount { country: string; prefix: string; trainRows: number; /** * The part of `trainRows` the retention table keeps in train. */ retainedTrainRows: number; } export interface HoldoutSpanCountResult { counts: HoldoutSpanCount[]; postcodes: HoldoutPostcodeCount[]; filesRead: number; } /** * Count the rows of every country `holdouts` declares that have each region surface * and locality as that span. * * Split the counts into train and held-out (val or test) rows. * Also count train rows that have each declared postcode prefix. * A row carrying one surface twice counts once. * * With `retention`, a train row whose country–shape combination it covers also counts as retained. * * @throws When a manifest file records neither a split nor a split attribute, * since reading it as train or as held out would both misstate the count. */ export declare function countHoldoutSpans(manifestPath: string, holdouts: Record, limits?: DuckDBLimits, retention?: Pick): Promise; /** * The minimum rows a region surface must have across every split before * {@linkcode holdoutSpanFindings} checks its train supply. * * A surface below this is a misspelling or a stray label rather than a region. */ export declare const REGION_SURFACE_MIN_ROWS = 100; /** * The lowest train share a region may keep, as a fraction of its country's median region train share. * * A holdout of a place below the region removes a small part of every region it touches. * Each region's train share therefore stays near the median. * A region held out whole falls to 0. */ export declare const REGION_TRAIN_SHARE_FLOOR = 0.5; /** * One way a holdout removes a label from training, or leaves a held-out place in it. */ export interface HoldoutSpanFinding { country: string; /** * - `region-key`: the policy lists a region, a closed-vocabulary label, as a key. * - `locality-in-train`: train rows the retention table doesn't keep still have a declared locality. * - `postcode-in-train`: train rows the retention table doesn't keep still * have a declared postcode prefix. * - `region-supply`: a region surface whose train share falls below * {@linkcode REGION_TRAIN_SHARE_FLOOR} of its country's median. * - `region-supply-without-postcode`: the same among rows with no postcode. */ reason: "region-key" | "locality-in-train" | "postcode-in-train" | "region-supply" | "region-supply-without-postcode"; key: string; trainRows: number; heldOutRows: number; } /** * The declared keys and region surfaces that `result` shows removing a label from * training or leaving a held-out place in it. */ export declare function holdoutSpanFindings(result: Pick, holdouts: Record): HoldoutSpanFinding[]; //# sourceMappingURL=held-out-spans.d.ts.map