skglm.datafits.QuadraticGroup#
- class skglm.datafits.QuadraticGroup(grp_ptr, grp_indices)[source]#
Quadratic datafit used with group penalties.
The datafit reads:
`1 / (2 xx n_"samples") ||y - Xw||_2 ^ 2`- Attributes:
- grp_indicesarray, shape (n_features,)
The group indices stacked contiguously ([grp1_indices, grp2_indices, …]).
- grp_ptrarray, shape (n_groups + 1,)
The group pointers such that two consecutive elements delimit the indices of a group in
grp_indices
.
Methods
__init__
(grp_ptr, grp_indices)get_lipschitz
(X, y)get_spec
()Specify the numba types of the class attributes.
gradient_g
(X, y, w, Xw, g)gradient_scalar
(X, y, w, Xw, j)initialize
(X, y)Pre-computations before fitting on X and y.
initialize_sparse
(X_data, X_indptr, X_indices, y)Pre-computations before fitting on X and y when X is a sparse matrix.
intercept_update_step
(y, Xw)params_to_dict
()Get the parameters to initialize an instance of the class.
value
(y, w, Xw)Value of datafit at vector w.