celer.GroupLassoCV¶
- class celer.GroupLassoCV(groups=None, eps=0.001, n_alphas=100, alphas=None, fit_intercept=True, max_iter=100, tol=0.0001, cv=None, verbose=0, max_epochs=50000, p0=10, prune=True, precompute='auto', positive=False, n_jobs=None)[source]¶
GroupLassoCV scikit-learn estimator based on Celer solver
The best model is selected by cross-validation.
The optimization objective for the Group Lasso is:
(1 / (2 * n_samples)) * ||y - X w||^2_2 + alpha * \sum_g ||w_g||_2
where w_g is the weight vector of group number g.
- 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.
- epsfloat, optional
Length of the path.
eps=1e-3
means thatalpha_min / alpha_max = 1e-3
.- n_alphasint, optional
Number of alphas along the regularization path.
- alphasnumpy array, optional
List of alphas where to compute the models. If
None
alphas are set automatically- fit_interceptboolean, 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).
- max_iterint, optional
The maximum number of iterations (subproblem definitions).
- tolfloat, optional
Stopping criterion for the optimization: the solver runs until the duality gap is smaller than
tol * norm(y) ** 2 / len(y)
or the maximum number of iteration is reached.- cvint, 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.
- verbosebool or integer
Amount of verbosity.
- max_epochsint, optional (default=50000)
Maximum number of coordinate descent epochs when solving a subproblem.
- p0int, optional (default=10)
Number of features in the first working set.
- prunebool, optional (default=True)
Whether to use pruning when growing the working sets.
- precomputeignored parameter, kept for sklearn compatibility.
- positivebool, optional (default=False)
When set to True, forces the coefficients to be positive.
- n_jobsint or None, optional (default=None)
Number of CPUs to use during the cross validation.
None
means 1 unless in ajoblib.parallel_backend
context.-1
means using all processors.
See also
- 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__(groups=None, eps=0.001, n_alphas=100, alphas=None, fit_intercept=True, max_iter=100, tol=0.0001, cv=None, verbose=0, max_epochs=50000, p0=10, prune=True, precompute='auto', positive=False, n_jobs=None)[source]¶
Methods
__init__
([groups, eps, n_alphas, alphas, ...])fit
(X, y[, sample_weight])Fit linear model with coordinate descent.
get_metadata_routing
()Get metadata routing of this object.
get_params
([deep])Get parameters for this estimator.
path
(X, y, alphas[, coef_init])Compute GroupLasso path with Celer.
predict
(X)Predict using the linear model.
score
(X, y[, sample_weight])Return the coefficient of determination of the prediction.
set_fit_request
(*[, sample_weight])Request metadata passed to the
fit
method.set_params
(**params)Set the parameters of this estimator.
set_score_request
(*[, sample_weight])Request metadata passed to the
score
method.