Module Modelkit.Logistic_regression

Weighted binary logistic regression with an L2 coefficient penalty.

Exactly two positively weighted integer classes are supported and stored in ascending order. c is the positive inverse regularization strength. Stable sigmoid and softplus formulas avoid overflow. Deterministic damped Newton iterations stop on gradient or step tolerance; exhausting max_iterations is a typed convergence failure. Fit costs O(iterations * samples * features squared) and prediction costs O(samples * features).

type params = {
  1. c : float;
  2. fit_intercept : bool;
  3. tolerance : float;
  4. max_iterations : int;
}
type t
type fitted
val create : ?c:float -> ?fit_intercept:bool -> ?tolerance:float -> ?max_iterations:int -> unit -> (t, Error.t) result
val coefficients : fitted -> Vector.t
val intercept : fitted -> float
val classes : fitted -> int array
val report : fitted -> Solver_report.t
val decision_function : fitted -> feature_schema:Feature_schema.t -> x:Matrix.t -> (Vector.t, Error.t) result
val predict_proba : fitted -> feature_schema:Feature_schema.t -> x:Matrix.t -> (Matrix.t, Error.t) result
include CLASSIFIER with type t := t and type params := params and type fitted := fitted and type rng = Rng.t
include ESTIMATOR with type target = Target.classification Target.t and type prediction = Target.classification 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 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