/** Options for `ridge`. */ export interface RidgeOptions { /** Center X/y and fit an unpenalized intercept (default true). */ intercept?: boolean; } /** * Options for `lasso` and `elasticNet`, which add an iteration limit and a tolerance * to `RidgeOptions`. */ export interface CoordinateDescentOptions extends RidgeOptions { /** Maximum coordinate-descent sweeps (default 1000). */ maxIter?: number; /** Convergence tolerance on the max coefficient change per sweep (default 1e-7). */ tol?: number; } /** Result of a regularized regression: the coefficients and the intercept. */ export interface RegularizedRegressionResult { /** Fitted coefficients, one per predictor column (intercept excluded). */ coefficients: number[]; /** Fitted intercept (0 if `opts.intercept === false`). */ intercept: number; } /** * Ridge regression (L2-penalized least squares) with a closed-form solution on * centered data: `β = (XᵀX + αI)⁻¹Xᵀy`. The intercept is never penalized. * * @param X - Design matrix (rows = observations, cols = predictors) * @param y - Response vector (length = number of observations) * @param alpha - L2 penalty strength (`alpha >= 0`; `alpha = 0` is OLS) * @param opts - `intercept` (default true) * * @example * ridge([[1], [2], [3], [4]], [2, 4, 6, 8], 0) * // => { coefficients: [2], intercept: 0 } (recovers the exact OLS fit) */ export declare function ridge(X: number[][], y: number[], alpha: number, opts?: RidgeOptions): RegularizedRegressionResult; /** * Lasso regression (L1-penalized least squares) via cyclic coordinate descent * with soft-thresholding on standardized columns. Unlike ridge, large enough * penalties drive coefficients to exactly 0 (sparse solutions). The intercept * is never penalized. * * @param X - Design matrix (rows = observations, cols = predictors) * @param y - Response vector (length = number of observations) * @param alpha - L1 penalty strength (`alpha >= 0`; `alpha = 0` ~ OLS) * @param opts - `intercept` (default true), `maxIter` (default 1000), `tol` (default 1e-7) * * @example * lasso([[1], [2], [3], [4]], [2, 4, 6, 8], 100) * // => coefficients[0] === 0 (penalty overwhelms the signal) */ export declare function lasso(X: number[][], y: number[], alpha: number, opts?: CoordinateDescentOptions): RegularizedRegressionResult; /** * Elastic-net regression combining an L1 penalty (`alpha * l1Ratio`, soft- * thresholded) and an L2 penalty (`alpha * (1 - l1Ratio)`, added to the * coordinate-descent denominator) via the same cyclic coordinate descent as * `lasso`. `l1Ratio = 1` is pure lasso; `l1Ratio = 0` is (coordinate-descent) * ridge. The intercept is never penalized. * * @param X - Design matrix (rows = observations, cols = predictors) * @param y - Response vector (length = number of observations) * @param alpha - Overall penalty strength (`alpha >= 0`) * @param l1Ratio - Mixing parameter in `[0, 1]` between L1 and L2 * @param opts - `intercept` (default true), `maxIter` (default 1000), `tol` (default 1e-7) * * @example * elasticNet([[1], [2], [3], [4]], [2, 4, 6, 8], 0.1, 0.5) * // => finite coefficients blending ridge shrinkage and lasso sparsity */ export declare function elasticNet(X: number[][], y: number[], alpha: number, l1Ratio: number, opts?: CoordinateDescentOptions): RegularizedRegressionResult; //# sourceMappingURL=regularized-regression.d.ts.map