Skip to main content

Module binomial_multi

Module binomial_multi 

Source
Expand description

Penalized multi-output binomial-logit fitter at fixed λ.

This is the row-diagonal sibling of crate::multinomial: the same shared design X ∈ ℝ^{N×P} and shared penalty S ∈ ℝ^{P×P} are reused across K independent binomial-logit response columns. Per-column smoothing parameters λ_a (length K) scale S independently for each response. Because the Fisher information has no cross-column coupling (H_{n,a,b} = δ_{ab} · w_n · μ_{n,a} (1 − μ_{n,a})), the joint penalized Hessian is block-diagonal in the K P × P per-response systems; the shared crate::penalized_vector_glm engine factors that block-diagonal Hessian in a single coupled damped-Newton loop, which is mathematically identical to K independent per-column solves.

§Fit problem

Minimise the penalized negative log-likelihood

  F(β) = − Σ_n Σ_a w_n [ y_{n,a} log μ_{n,a} + (1 − y_{n,a}) log(1 − μ_{n,a}) ]
          + ½ Σ_a λ_a · β_aᵀ S β_a

with μ_{n,a} = σ(η_{n,a}), η_{n,a} = (X β_a)_n. The per-column Newton step solves

  (Xᵀ diag(w_n μ_{n,a}(1 − μ_{n,a})) X + λ_a S) δ_a = − [Xᵀ diag(w_n)(μ_{·,a} − y_{·,a}) + λ_a S β_a]

followed by a backtracking line search on F (full step first, halve up to 8 times) so monotone descent is enforced even when the quadratic model overshoots near saturation. This is precisely the shared crate::penalized_vector_glm scaffold; this module supplies only the row-diagonal binomial Fisher block, residual, and log-likelihood via [BinomialMultiLikelihood].

§Relation to the multi-class softmax driver

crate::multinomial::fit_penalized_multinomial handles the coupled softmax Fisher block H_{n,a,b} = w_n μ_{n,a} (δ_{ab} − μ_{n,b}) and is the right entry when the user wants a single normalized probability vector per row. This driver is the right entry when the user has K independent binary marginals sharing a smooth basis (e.g. multi-label classification, multi-trait penalised logistic regression on a Duchon latent design). Both families are thin Fisher-block adapters over the same penalized_vector_glm engine: the only difference is that the softmax block is dense across outputs while these binomial columns are row-diagonal.

The function-boundary contract mirrors fit_penalized_multinomial so the two are interchangeable at the FFI layer: same input arity, same convergence semantics, same (N, K) fitted-probability output.

Structs§

BinomialMultiFitInputs
Inputs for fit_penalized_binomial_multi.
BinomialMultiFitOutputs
Outputs of fit_penalized_binomial_multi.

Functions§

fit_penalized_binomial_multi
Fit K independent penalized binomial-logit GLMs sharing the design X and penalty S. See the module docs for the optimization problem.