Module Modelkit.Lasso_path

A descending lasso regularization path fitted with deterministic warm starts.

Without explicit alphas, fit constructs count logarithmically spaced values from the smallest alpha producing the all-zero centered solution to epsilon times that value. Explicit alphas are copied, validated, and sorted descending. Coefficient-matrix rows, intercepts, reports, and model indices all use this same order. A path of a alpha values costs the sum of its warm-started coordinate-descent sweeps and stores O(a * p) fitted coefficients.

type params = {
  1. fit_intercept : bool;
  2. epsilon : float;
  3. count : int;
  4. tolerance : float;
  5. max_iterations : int;
}
type t
type fitted
val create : ?fit_intercept:bool -> ?epsilon:float -> ?count:int -> ?tolerance:float -> ?max_iterations:int -> unit -> (t, Error.t) result
val fit : t -> ?alphas:Vector.t -> ?sample_weight:Sample_weight.t -> rng:Rng.t -> feature_schema:Feature_schema.t -> x:Matrix.t -> y:Target.regression Target.t -> unit -> (fitted, Error.t) result
val params : t -> params
val alphas : fitted -> Vector.t
val coefficients : fitted -> Matrix.t

Returns one coefficient row per descending alpha.

val intercepts : fitted -> Vector.t
val reports : fitted -> Solver_report.t array
val model : fitted -> index:int -> (Lasso_regression.fitted, Error.t) result