skglm.WeightedLasso#

class skglm.WeightedLasso(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]#

WeightedLasso estimator based on Celer solver and primal extrapolation.

The optimization objective for WeightedLasso is:

`1 / (2 xx n_"samples") ||y - Xw||_2 ^ 2 + alpha ||w||_1`
Parameters:
alphafloat, optional

Penalty strength.

weightsarray, shape (n_features,), 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

The maximum number of iterations (subproblem definitions).

max_epochsint

Maximum number of CD epochs on each subproblem.

p0int

First working set size.

verbosebool or int

Amount of verbosity.

tolfloat, optional

Stopping criterion for the optimization.

positivebool, optional

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

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

See also

MCPRegression

Sparser regularization than L1 norm.

Lasso

Unweighted Lasso regularization.

Notes

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

Attributes:
coef_array, shape (n_features,)

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

sparse_coef_scipy.sparse matrix, shape (n_features, 1)

sparse_coef_ is a readonly property derived from coef_

intercept_float

constant term in decision function.

n_iter_int

Number of subproblems solved to reach the specified tolerance.

__init__(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__([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.

path(X, y, alphas[, coef_init, return_n_iter])

Compute Weighted Lasso path.

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.