Module Modelkit.Elastic_net_regression

Weighted scalar regression with combined L1 and L2 regularization.

The minimized penalty is alpha * l1_ratio * L1 plus 0.5 * alpha * (1 - l1_ratio) * L2 squared. l1_ratio is in [0, 1]; one is lasso and zero is a pure L2 penalty. The optional intercept remains unpenalized. Deterministic cyclic coordinate descent returns a Solver_report.t or a typed convergence failure. For n samples and p features, each sweep costs O(n * p) and fitting uses O(n + p) working storage.

type params = {
  1. alpha : float;
  2. l1_ratio : float;
  3. fit_intercept : bool;
  4. tolerance : float;
  5. max_iterations : int;
}
type t
type fitted
val create : ?alpha:float -> ?l1_ratio:float -> ?fit_intercept:bool -> ?tolerance:float -> ?max_iterations:int -> unit -> (t, Error.t) result
val coefficients : fitted -> Vector.t
val intercept : fitted -> float
val report : fitted -> Solver_report.t
include REGRESSOR with type t := t and type params := params and type fitted := fitted and type rng = Rng.t
include ESTIMATOR with type target = Target.regression Target.t and type prediction = Target.regression Target.t with type t := t with type params := params with type fitted := fitted with type rng = Rng.t
include SPECIFICATION with type t := t with type params := params
val clone : t -> t
val params : t -> params
type prediction = Target.regression Target.t
type rng = Rng.t
val fit : t -> ?sample_weight:Sample_weight.t -> rng:rng -> feature_schema:Feature_schema.t -> x:Matrix.t -> y:target -> unit -> (fitted, Error.t) result
val predict : fitted -> feature_schema:Feature_schema.t -> x:Matrix.t -> (prediction, Error.t) result
val fitted_params : fitted -> params
val feature_schema : fitted -> Feature_schema.t