Adaptive#

class superglm.Adaptive(expon: float = 1.0, eps: float = 1e-06)#

Bases: object

Adaptive weighting flavor.

Computes per-group weights inversely proportional to the initial estimate’s group norms. Groups with large initial coefficients get smaller penalties (kept more easily); groups with small coefficients get larger penalties (zeroed more aggressively).

This gives the adaptive group lasso better oracle properties than the plain group lasso (Zou, 2006; Wang & Leng, 2008).

Parameters:
exponfloat

Exponent for the inverse weighting. Higher values increase the contrast between large and small groups.

epsfloat

Small constant to avoid division by zero for initially-zeroed groups.

adjust_weights(
groups: list[GroupSlice],
beta_init: NDArray,
group_matrices: list | None = None,
) → list[GroupSlice]#

Return new GroupSlice list with adaptive weights.

When group_matrices is provided, uses fitted-value norms ||X_g beta_g|| / sqrt(n) (RMS contribution to eta) instead of raw coefficient norms. This is scale-invariant across groups with different reparametrizations (e.g. SSP splines).

Without group_matrices, falls back to coefficient norms: new_weight_g = sqrt(p_g) / (||beta_init_g|| + eps)^expon