celer.LassoCV

class celer.LassoCV(eps=0.001, n_alphas=100, alphas=None, fit_intercept=True, normalize=False, max_iter=100, tol=0.0001, cv=None, verbose=0, gap_freq=10, max_epochs=50000, p0=10, prune=0, precompute='auto')

LassoCV scikit-learn estimator based on Celer solver

The best model is selected by cross-validation.

The optimization objective for Lasso is:

(1 / (2 * n_samples)) * ||y - X w||^2_2 + alpha * ||w||_1
Parameters:
eps : float, optional

Length of the path. eps=1e-3 means that alpha_min / alpha_max = 1e-3.

n_alphas : int, optional

Number of alphas along the regularization path.

alphas : numpy array, optional

List of alphas where to compute the models. If None alphas are set automatically

fit_intercept : boolean, default True

whether to calculate the intercept for this model. If set to false, no intercept will be used in calculations (e.g. data is expected to be already centered).

normalize : bool, optional (default=False)

This parameter is ignored when fit_intercept is set to False. If True, the regressors X will be normalized before regression by subtracting the mean and dividing by the l2-norm.

max_iter : int, optional

The maximum number of iterations (subproblem definitions).

tol : float, optional

The tolerance for the optimization: the solver runs until the duality gap is smaller than tol or the maximum number of iteration is reached.

cv : int, cross-validation generator or an iterable, optional

Determines the cross-validation splitting strategy. Possible inputs for cv are: - None, to use the default 3-fold cross-validation, - integer, to specify the number of folds. - An object to be used as a cross-validation generator. - An iterable yielding train/test splits. For integer/None inputs, sklearn KFold is used.

verbose : bool or integer

Amount of verbosity.

gap_freq : int, optional (default=10)

In the inner loop, the duality gap is computed every gap_freq coordinate descent epochs.

max_epochs : int, optional (default=50000)

Maximum number of coordinate descent epochs when solving a subproblem.

p0 : int, optional (default=10)

Number of features in the first working set.

prune : bool, optional (default=False)

Whether to use pruning when growing the working sets.

precompute : ignored parameter, kept for sklearn compatibility.

See also

celer_path, Lasso

Attributes:
alpha_ : float

The amount of penalization chosen by cross validation

coef_ : array, shape (n_features,)

parameter vector (w in the cost function formula)

intercept_ : float

independent term in decision function.

mse_path_ : array, shape (n_alphas, n_folds)

mean square error for the test set on each fold, varying alpha

alphas_ : numpy array, shape (n_alphas,)

The grid of alphas used for fitting

dual_gap_ : ndarray, shape ()

The dual gap at the end of the optimization for the optimal alpha (alpha_).

n_iter_ : int

number of iterations run by the coordinate descent solver to reach the specified tolerance for the optimal alpha.

__init__(eps=0.001, n_alphas=100, alphas=None, fit_intercept=True, normalize=False, max_iter=100, tol=0.0001, cv=None, verbose=0, gap_freq=10, max_epochs=50000, p0=10, prune=0, precompute='auto')

Methods

__init__([eps, n_alphas, alphas, …])
fit(X, y) Fit linear model with coordinate descent
get_params([deep]) Get parameters for this estimator.
path(X, y, alphas, **kwargs) Compute Lasso path with Celer.
predict(X) Predict using the linear model
score(X, y[, sample_weight]) Returns the coefficient of determination R^2 of the prediction.
set_params(**params) Set the parameters of this estimator.
Fork me on GitHub