Expand description
Generalized linear models (ISL ch 4) — logistic and Poisson regression by iteratively reweighted least squares (IRLS).
Each IRLS step is a weighted least-squares solve of (DᵀWD)β = DᵀWz, done with
the engine’s linear_algebra::cholesky (no re-implemented solver); the Wald
standard errors come from (DᵀWD)⁻¹ at convergence and the p-values from the
Normal CDF in statistics::distributions. Kernel-class: DenseLinear per step
(dispatch-ready); the IRLS loop itself is scalar CPU.
Re-exports§
pub use family::Family;pub use multinomial::MultinomialLogistic;
Modules§
- family
- GLM exponential-family links — the per-family functions the IRLS loop needs. Both families use their canonical link.
- multinomial
- Multinomial logistic regression / softmax classifier (ISL ch 4.3.5, PRML ch 4).
Structs§
- GlmModel
- A fitted GLM.
coefficients[0]is the intercept whenfit_intercept.
Functions§
- fit
- Fit a GLM of
y(lengthn) on a row-majorn × ppredictor matrix by IRLS.fit_interceptprepends a constant column. Fails closed:InvalidDimension,InsufficientData(n ≤ params),Singular(collinear / perfectly separated),NotConverged. - fit_
logistic - Convenience: logistic regression (Bernoulli
y ∈ {0,1}). - fit_
poisson - Convenience: Poisson regression (count
y ≥ 0).