import { type PathBuilderLike } from "path-ts"; import { type DuckDBLimits } from "#parquet/duckdb"; /** * One stored file of the source and its split attribute, by local path. */ export interface DrawWeightInputFile { parquet: string; splitAttribute: string; } export interface DrawWeightOverlayOptions { /** * The `source` value every row of the files holds. */ source: string; files: readonly DrawWeightInputFile[]; /** * A regular expression whose first group captures the integer record id inside a row's `source_id`. */ keyPattern: string; /** * Each scored record's score, by id. * A record absent from the table has no score. */ scores: ReadonlyMap; /** * The raw weight of a row whose record has no score, and the least raw weight of any row. */ floor: number; /** * The overlay directory. * * Each rewritten file and its attribute are written at its top level. */ outDir: PathBuilderLike; limits?: DuckDBLimits; } /** * One rewritten file, by its name under the overlay directory. */ export interface DrawWeightedFile { parquet: string; splitAttribute: string; rows: number; } /** * The weights the rewrite wrote, measured over the source's train rows. */ export interface DrawWeightSummary { files: DrawWeightedFile[]; floor: number; trainRows: number; /** * Train rows whose record has a score. */ scoredTrainRows: number; /** * Train rows whose raw weight is the floor: every unscored row, and each scored row below it. */ floorTrainRows: number; /** * The mean raw weight over the train rows. * Every raw weight is divided by this mean. */ rawTrainMean: number; /** * The draw weight of a floor row. */ floorWeight: number; /** * The largest draw weight in the files, the bound the sampler divides by. */ maxWeight: number; /** * Draw-weight quantiles over the train rows, keyed by quantile. */ quantiles: Record; } /** * Writes each of `files` again with a `draw_weight` column and the split * attribute that describes the new file. * * @throws When a row's `source_id` yields no record id, a row holds another source, * a file already stores the column, or a rewritten file's rows differ from the input's. */ export declare function writeDrawWeightedFiles(options: DrawWeightOverlayOptions): Promise; //# sourceMappingURL=draw-weight.d.ts.map