package modelkit
Module Modelkit.Multinomial_logistic_regression
Weighted multinomial logistic regression with an L2 coefficient penalty.
At least three positively weighted integer classes are required and stored in ascending order. The solver jointly minimizes stable softmax cross-entropy and the coefficient penalty under a sum-to-zero class-score constraint; intercepts are not penalized. c is the positive inverse regularization strength. Deterministic damped Newton iterations stop on gradient or step tolerance, and iteration exhaustion is a typed convergence failure.
Coefficient rows, intercept entries, decision columns, and probability columns all follow ascending class order. Exact prediction ties select the lowest label. For k classes, n samples, and p augmented features, fitting costs O(iterations * (n * k squared * p squared + k cubed * p cubed)); prediction costs O(n * k * p).
val classes : fitted -> int arrayval report : fitted -> Solver_report.tinclude 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
type target = Target.classification Target.ttype prediction = Target.classification Target.ttype rng = Rng.tval fit :
t ->
?sample_weight:Sample_weight.t ->
rng:rng ->
feature_schema:Feature_schema.t ->
x:Matrix.t ->
y:target ->
unit ->
(fitted, Error.t) resultval predict :
fitted ->
feature_schema:Feature_schema.t ->
x:Matrix.t ->
(prediction, Error.t) resultval feature_schema : fitted -> Feature_schema.t