Module Modelkit.Elastic_net_path

A descending elastic-net regularization path with deterministic warm starts.

Path ordering and access follow Lasso_path. Automatic alpha generation requires positive l1_ratio, because a pure L2 penalty has no finite alpha at which every coefficient is forced to zero; explicit alphas remain valid when l1_ratio is zero. A path of a alpha values stores O(a * p) fitted coefficients.

type params = {
  1. l1_ratio : float;
  2. fit_intercept : bool;
  3. epsilon : float;
  4. count : int;
  5. tolerance : float;
  6. max_iterations : int;
}
type t
type fitted
val create : ?l1_ratio:float -> ?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 -> (Elastic_net_regression.fitted, Error.t) result