import { Cat } from './cat'; import { CatMap } from './type'; /** * Interface for input parameters to EarlyStopping classes. */ export interface EarlyStoppingInput { /** The logical operation to use to evaluate multiple stopping conditions */ logicalOperation?: 'and' | 'or' | 'only' | 'AND' | 'OR' | 'ONLY'; } export interface StopAfterNItemsInput extends EarlyStoppingInput { /** Number of items to require before stopping */ requiredItems: CatMap; } export interface StopOnSEMeasurementPlateauInput extends EarlyStoppingInput { /** Number of items to wait for before triggering early stopping */ patience: CatMap; /** Tolerance for standard error of measurement drop */ tolerance?: CatMap; } export interface StopIfSEMeasurementBelowThresholdInput extends EarlyStoppingInput { /** Stop if the standard error of measurement drops below this level */ seMeasurementThreshold: CatMap; /** Number of items to wait for before triggering early stopping */ patience?: CatMap; /** Tolerance for standard error of measurement drop */ tolerance?: CatMap; } /** * Abstract class for early stopping strategies. */ export declare abstract class EarlyStopping { protected _earlyStop: boolean; protected _nItems: CatMap; protected _seMeasurements: CatMap; protected _logicalOperation: 'and' | 'or' | 'only'; constructor({ logicalOperation }: EarlyStoppingInput); abstract get evaluationCats(): string[]; get earlyStop(): boolean; get nItems(): CatMap; get seMeasurements(): CatMap; get logicalOperation(): "and" | "or" | "only"; /** * Update the internal state of the early stopping strategy based on the provided cats. * @param {CatMap}cats - A map of cats to update. */ protected _updateCats(cats: CatMap): void; /** * Abstract method to be implemented by subclasses to evaluate a single stopping condition. * @param {string} catToEvaluate - The name of the cat to evaluate for early stopping. */ protected abstract _evaluateStoppingCondition(catToEvaluate: string): boolean; /** * Abstract method to be implemented by subclasses to update the early stopping strategy. * @param {CatMap} cats - A map of cats to update. */ update(cats: CatMap, catToEvaluate?: string): void; } /** * Class implementing early stopping based on a plateau in standard error of measurement. */ export declare class StopOnSEMeasurementPlateau extends EarlyStopping { protected _patience: CatMap; protected _tolerance: CatMap; constructor(input: StopOnSEMeasurementPlateauInput); get evaluationCats(): string[]; get patience(): CatMap; get tolerance(): CatMap; protected _evaluateStoppingCondition(catToEvaluate: string): boolean; } /** * Class implementing early stopping after a certain number of items. */ export declare class StopAfterNItems extends EarlyStopping { protected _requiredItems: CatMap; constructor(input: StopAfterNItemsInput); get requiredItems(): CatMap; get evaluationCats(): string[]; protected _evaluateStoppingCondition(catToEvaluate: string): boolean; } /** * Class implementing early stopping if the standard error of measurement drops below a certain threshold. */ export declare class StopIfSEMeasurementBelowThreshold extends EarlyStopping { protected _patience: CatMap; protected _tolerance: CatMap; protected _seMeasurementThreshold: CatMap; constructor(input: StopIfSEMeasurementBelowThresholdInput); get patience(): CatMap; get tolerance(): CatMap; get seMeasurementThreshold(): CatMap; get evaluationCats(): string[]; protected _evaluateStoppingCondition(catToEvaluate: string): boolean; }