import { ClassifierBase, RegressorBase } from '../base'; import { Params } from '../base/estimator'; export type DummyClassifierStrategy = 'prior' | 'mostFrequent' | 'stratified' | 'uniform' | 'constant'; export type DummyRegressorStrategy = 'mean' | 'median' | 'quantile' | 'constant'; export interface DummyClassifierProps { /** sklearn strategies; default 'prior'. */ strategy?: DummyClassifierStrategy; /** The class to always predict (strategy 'constant' only). */ constant?: number; /** Seed for the 'stratified' / 'uniform' strategies. */ randomState?: number; } export interface DummyRegressorProps { /** sklearn strategies; default 'mean'. */ strategy?: DummyRegressorStrategy; /** Quantile in [0, 1] (strategy 'quantile' only; 0.5 = median). */ quantile?: number; /** The value to always predict (strategy 'constant' only). */ constant?: number; } /** * Classifier that ignores the features, mirroring `sklearn.dummy.DummyClassifier`. * Useful as a baseline: any real model should beat it. * * Strategies: * - 'prior' (default): always predicts the most frequent class; * `predictProba` returns the empirical class prior for every row. * - 'mostFrequent': same predictions; `predictProba` returns the one-hot * vector of the mode. * - 'stratified': samples predictions from the empirical class distribution; * `predictProba` rows are random one-hot draws. * - 'uniform': samples classes uniformly; `predictProba` is 1/nClasses. * - 'constant': always predicts `constant` (must be one of the training * classes); `predictProba` is its one-hot vector. * * Randomness: the RNG for 'stratified'/'uniform' is needed at PREDICT time, * so `randomState` is stored and a fresh seeded generator is derived at the * start of every `predict`/`predictProba` call — repeated calls on the same * fitted model are therefore reproducible (and serialization-safe), unlike * sklearn where consecutive calls consume one shared RNG stream. */ export declare class DummyClassifier extends ClassifierBase { private strategy; private constant?; private randomState?; private classes; private classPrior; private fitted; constructor(props?: DummyClassifierProps); getParams(): Params; fit(X: number[][], y: number[], sampleWeight?: number[]): void; private ensureFitted; /** Categorical draw from the class prior. */ private drawFromPrior; predict(X: number[][]): number[]; predictProba(X: number[][]): number[][]; } /** * Regressor that ignores the features, mirroring `sklearn.dummy.DummyRegressor`. * * Strategies: 'mean' (default), 'median' (proper even/odd handling — the * average of the two middle values for even-length y), 'quantile' (linear * interpolation, numpy's default), 'constant'. * * Omitted vs sklearn: `sampleWeight` is only supported for strategy 'mean' * (sklearn also implements weighted percentiles for 'median'/'quantile'; * passing weights with those strategies throws here). */ export declare class DummyRegressor extends RegressorBase { private strategy; private quantile?; private constant?; private value; private fitted; constructor(props?: DummyRegressorProps); getParams(): Params; fit(X: number[][], y: number[], sampleWeight?: number[]): void; predict(X: number[][]): number[]; }