import { XGBTree } from './xgbTree'; export interface XGBoostProps { nEstimators?: number; n_estimators?: number; learningRate?: number; learning_rate?: number; maxDepth?: number; max_depth?: number; lambda?: number; reg_lambda?: number; gamma?: number; minChildWeight?: number; min_child_weight?: number; subsample?: number; colsampleByTree?: number; colsample_bytree?: number; baseScore?: number; base_score?: number; randomState?: number; random_state?: number; } /** * Resolved, validated hyper-parameters shared by the XGBoost models * (canonical camelCase keys — exactly the shape returned by getParams()). */ export interface XGBoostParams { nEstimators: number; learningRate: number; maxDepth: number; lambda: number; gamma: number; minChildWeight: number; subsample: number; colsampleByTree: number; baseScore: number; randomState: number | undefined; } /** * Resolve props (accepting both camelCase and snake_case aliases) to the * canonical parameter set, following xgboost's defaults: eta=0.3, * max_depth=6, lambda=1, gamma=0, min_child_weight=1, subsample=1, * colsample_bytree=1, base_score=0.5. */ export declare function resolveXGBoostProps(props?: XGBoostProps): XGBoostParams; /** * Objective: first/second-order gradients of the loss at margin F. * yInternal is whatever fitBoostedTrees() was given (raw targets for * regression, 0/1 labels for classification). */ export type GradientFn = (F: number[], yInternal: number[]) => { g: number[]; h: number[]; }; /** * Shared boosting loop for the XGBoost models (exact greedy). Returns the * fitted trees; the caller stores them together with the initial margin. */ export declare function fitBoostedTrees(X: number[][], yInternal: number[], initialMargin: number, params: XGBoostParams, gradients: GradientFn): XGBTree[]; export declare function predictBoostedMargin(trees: XGBTree[], baseMargin: number, learningRate: number, testX: number[][]): number[]; export declare function validateXGBoostFitInput(X: number[][], y: number[]): void;