himalaya.lasso.solve_sparse_group_lasso_cv¶
- himalaya.lasso.solve_sparse_group_lasso_cv(X, Y, groups=None, l21_regs=[0.05], l1_regs=[0.05], cv=5, max_iter=300, tol=0.0001, momentum=True, n_targets_batch=None, progress_bar=True)[source]¶
Solves the sparse group Lasso, selecting hyperparameters over cross-validation.
- Parameters
- Xarray of shape (n_samples, n_features)
Input features.
- Yarray of shape (n_samples, n_targets)
Target data.
- groupsarray of shape (n_features, ) or None
Encoding of the group of each feature. If None, all features are gathered in one group, and the problem is equivalent to the Lasso.
- l21_regsarray of shape (n_l21_regs, )
All the Group Lasso regularization parameter tested.
- l1_regsarray of shape (n_l1_regs, )
All the Lasso regularization parameter tested.
- cvint or scikit-learn splitter
Cross-validation splitter. If an int, KFold is used.
- max_iterint > 0
Maximum number of iterations.
- tolfloat > 0
Tolerance of the stopping criterion.
- momentumbool
If True, use acceleration in the projected gradient descent.
- n_targets_batchint or None
Size of the batch for computing predictions. Used for memory reasons. If None, uses all n_targets at once.
- progress_barbool
If True, display a progress bar over batches and iterations.
- Returns
- coefarray of shape (n_features, n_targets)
Coefficient of the linear model. Always on CPU.
- best_l21_regarray of shape (n_targets, )
Best hyperparameter per target.
- best_l1_regarray of shape (n_targets, )
Best hyperparameter per target.
- all_cv_scoresarray of shape (n_l21_regs * n_l1_regs, n_targets)
Cross-validation scores of all tested hyperparameters.