When coefficients come in groups (the levels of a categorical variable, a block of a signal), the group lasso switches whole groups on or off:
where is the sub-vector of group (plain 2-norm, no group-size weights).
Implement:
group_soft_threshold(v, groups, t): the proximal operator of . groups is an integer array (same length as v) giving each coefficient's group id. For each group, shrink the sub-vector toward zero: , with an all-zero group staying zero.group_lasso_ista(X, y, groups, lam, n_iter=500, step=None): proximal gradient descent from : n_iter steps of with step = step, or when step is None. Return .debias(X, y, w): refit ordinary least squares (np.linalg.lstsq) using only the columns where w is nonzero; all other coefficients are 0. Return the new weight vector.