skglm.GroupLasso

class skglm.GroupLasso(groups, alpha=1.0, weights=None, max_iter=50, max_epochs=50000, p0=10, verbose=0, tol=0.0001, positive=False, fit_intercept=True, warm_start=False, ws_strategy='subdiff')[source]

GroupLasso estimator based on Celer solver and primal extrapolation.

The optimization objective for GroupLasso is:

`1 / (2 xx n_"samples") ||y - X w||_2 ^ 2 + alpha \sum_g weights_g ||w_{[g]}||_2`

with `w_{[g]}` the coefficients of the g-th group.

Parameters:
groupsint | list of ints | list of lists of ints

Partition of features used in the penalty on w. If an int is passed, groups are contiguous blocks of features, of size groups. If a list of ints is passed, groups are assumed to be contiguous, group number g being of size groups[g]. If a list of lists of ints is passed, groups[g] contains the feature indices of the group number g.

alphafloat, optional

Penalty strength.

weightsarray, shape (n_groups,), optional (default=None)

Positive weights used in the L1 penalty part of the Lasso objective. If None, weights equal to 1 are used.

max_iterint, optional (default=50)

The maximum number of iterations (subproblem definitions).

max_epochsint, optional (default=50_000)

Maximum number of CD epochs on each subproblem.

p0int, optional (default=10)

First working set size.

verbosebool or int, optional (default=0)

Amount of verbosity.

tolfloat, optional (default=1e-4)

Stopping criterion for the optimization.

positivebool, optional (defautl=False)

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

fit_interceptbool, optional (default=True)

Whether or not to fit an intercept.

warm_startbool, optional (default=False)

When set to True, reuse the solution of the previous call to fit as initialization, otherwise, just erase the previous solution.

ws_strategystr, optional (default=”subdiff”)

The score used to build the working set. Can be fixpoint or subdiff.

Notes

Supports weights equal to 0, i.e. unpenalized features.

Attributes:
coef_array, shape (n_features,)

parameter vector (`w` in the cost function formula)

intercept_float

constant term in decision function.

n_iter_int

Number of subproblems solved to reach the specified tolerance.

__init__(groups, alpha=1.0, weights=None, max_iter=50, max_epochs=50000, p0=10, verbose=0, tol=0.0001, positive=False, fit_intercept=True, warm_start=False, ws_strategy='subdiff')[source]

Methods

__init__(groups[, alpha, weights, max_iter, ...])

fit(X, y)

Fit the model according to the given training data.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

predict(X)

Predict using the linear model.

score(X, y[, sample_weight])

Return the coefficient of determination of the prediction.

set_params(**params)

Set the parameters of this estimator.

set_score_request(*[, sample_weight])

Request metadata passed to the score method.