sparsereg.vendor.group_lasso package

Submodules

sparsereg.vendor.group_lasso.group_lasso module

sparsereg.vendor.group_lasso.group_lasso.soft_threshold(a, b)[source]
sparsereg.vendor.group_lasso.group_lasso.sparse_group_lasso(X, y, alpha, rho, groups, max_iter=1000, rtol=1e-06, verbose=False)[source]

Linear least-squares with l2/l1 + l1 regularization solver.

Solves problem of the form:

(1 / (2 n_samples)) * ||Xb - y||^2_2 +
[ (alpha * (1 - rho) * sum(sqrt(#j) * ||b_j||_2) + alpha * rho ||b_j||_1) ]

where b_j is the coefficients of b in the j-th group. Also known as the sparse group lasso.

Parameters:
  • X (array of shape (n_samples, n_features)) – Design Matrix.
  • y (array of shape (n_samples,)) –
  • alpha (float or array) – Amount of penalization to use.
  • groups (array of shape (n_features,)) – Group label. For each column, it indicates its group apertenance.
  • rtol (float) – Relative tolerance. ensures ||(x - x_) / x_|| < rtol, where x_ is the approximate solution and x is the true solution. TODO duality gap
Returns:

x – vector of coefficients

Return type:

array

References

“A sparse-group lasso”, Noah Simon et al.

sparsereg.vendor.group_lasso.group_lasso.group_lasso_check_kkt(A, b, x, alpha, groups)[source]

Auxiliary function. Check KKT conditions for the group lasso

Returns True if conditions are satisfied, False otherwise

Module contents