skglm.solvers.GramCD

class skglm.solvers.GramCD(max_iter=100, use_acc=False, greedy_cd=True, tol=0.0001, fit_intercept=True, warm_start=False, verbose=0)[source]

Coordinate descent solver keeping the gradients up-to-date with Gram updates.

This solver should be used when n_features < n_samples, and computes the (n_features, n_features) Gram matrix which comes with an overhead. It is only suited to Quadratic datafits.

It minimizes:

`1 / (2 xx n_"samples") ||y - Xw||^2 + "penalty"(w)`

which can be rewritten as:

`1 / (2 xx n_"samples") w^T Q w - 1 / n_"samples" q^T w + "penalty"(w)`

where:

`Q = X^T X " (gram matrix), and " q = X^T y`
Attributes:
max_iterint, default 100

Maximum number of iterations.

w_initarray, shape (n_features,), default None

Initial value of coefficients. If set to None, a zero vector is used instead.

use_accbool, default False

Extrapolate the iterates based on the past 5 iterates if set to True. Can only be used when greedy_cd is False.

greedy_cdbool, default True

Use a greedy strategy to select features to update in coordinate descent epochs if set to True. A cyclic strategy is used otherwise.

tolfloat, default 1e-4

Tolerance for convergence.

verbosebool, default False

Amount of verbosity. 0/False is silent.

__init__(max_iter=100, use_acc=False, greedy_cd=True, tol=0.0001, fit_intercept=True, warm_start=False, verbose=0)[source]

Methods

__init__([max_iter, use_acc, greedy_cd, ...])

custom_checks(X, y, datafit, penalty)

Ensure the solver is suited for the datafit + penalty problem.

solve(X, y, datafit, penalty[, w_init, ...])

Solve the optimization problem after validating its compatibility.