skglm.penalties.WeightedGroupL2#
- class skglm.penalties.WeightedGroupL2(alpha, weights, grp_ptr, grp_indices)[source]#
 Weighted Group L2 penalty.
The penalty reads
`sum_{g=1}^{n_"groups"} "weights"_g xx ||w_{[g]}||`with `w_{[g]}` being the coefficients of the g-th group.
- Attributes:
 - alphafloat
 The regularization parameter.
- weightsarray, shape (n_groups,)
 The weights of the groups.
- grp_indicesarray, shape (n_features,)
 The group indices stacked contiguously ([grp1_indices, grp2_indices, …]).
- grp_ptrarray, shape (n_groups + 1,)
 The group pointers such that two consecutive elements delimit the indices of a group in
grp_indices.
Methods
__init__(alpha, weights, grp_ptr, grp_indices)generalized_support(w)Return a mask which is True for coefficients in the generalized support.
get_spec()Specify the numba types of the class attributes.
is_penalized(n_groups)Return a binary mask with the penalized features.
params_to_dict()Get the parameters to initialize an instance of the class.
prox_1group(value, stepsize, g)Compute the proximal operator of group
g.subdiff_distance(w, grad_ws, ws)Compute distance to the subdifferential at
wof negative gradient.value(w)Value of penalty at vector
w.