1.2.4 Results🔗ℹ

A fit prints as a one-line summary: its family, λ, the deviance ratio and how many predictors have a nonzero coefficient. The generics of Predictions and coefficients read it:

> (define fit (ridge X y #:lambda 0.1))
> fit

#<glmnet:gaussian λ=0.1 dev=0.9613 nz=2/2>

> (match-define (vector β₀ β₁ β₂) (coef fit))
> β₁

1.443502076515797

> (deviance-ratio fit)

0.9612982561192012

coef gives the intercept, then one coefficient per predictor, on the original (unstandardized) scale; a predictor the penalty dropped is exactly 0.0. Cox models have no intercept. The multinomial and multi-response families give one such vector per class or response; as in R, the multinomial intercepts are centred to sum to zero. deviance-ratio is the fraction of the null deviance explained, R² for the Gaussian families.

Each family’s result is a transparent struct, so equal? compares fits. Its fields, the intercept, coefficients, deviance ratio, λ and number of solver passes, have accessors (see Gaussian models).