skglm.penalties.WeightedGroupL2#

class skglm.penalties.WeightedGroupL2(alpha, weights, grp_ptr, grp_indices, positive=False)[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.

When positive=True, it reads

`sum_{g=1}^{n_"groups"} "weights"_g xx ||w_{[g]}|| + i_{w_{[g]} \geq 0}`

Where `i_{w_{[g]} \geq 0}` is the indicator function of the positive orthant.

Refer to Details on the Positive Group Lasso for details on the derivation of the proximal operator and the distance to subdifferential.

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.

positivebool, optional

When set to True, forces the coefficient vector to be positive.

__init__(alpha, weights, grp_ptr, grp_indices, positive=False)[source]#

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 w of negative gradient.

value(w)

Value of penalty at vector w.