adelie.solver.bvls#

adelie.solver.bvls(X: ndarray | MatrixNaiveBase32 | MatrixNaiveBase64, y: ndarray, lower: ndarray, upper: ndarray, *, weights: ndarray | None = None, kappa: int | None = None, max_iters: int = 100000, tol: float = 1e-07, n_threads: int = 1, warm_start=None)[source]#

Solves bounded variable least squares.

The bounded variable least squares is given by

\[\begin{split}\begin{align*} \mathrm{minimize}_{\beta} &\quad \frac{1}{2} \|y - X \beta\|_{W}^2 \\ \text{subject to} &\quad \ell \leq \beta \leq u \end{align*}\end{split}\]

where \(X \in \mathbb{R}^{n \times p}\) is the feature matrix, \(y \in \mathbb{R}^n\) is the response vector, \(W \in \mathbb{R}_+^{n \times n}\) is the (diagonal) observation weights, and \(\ell \leq u \in \mathbb{R}^p\) are the lower and upper bounds, respectively.

Parameters:
X(n, p) Union[ndarray, MatrixNaiveBase32, MatrixNaiveBase64]

Feature matrix. It is typically one of the matrices defined in adelie.matrix submodule or numpy.ndarray.

y(n,) ndarray

Response vector.

lower(p,) ndarray

Lower bound for each variable.

upper(p,) ndarray

Upper bound for each variable.

weights(n,) ndarray, optional

Observation weights. If None, it is set to np.full(n, 1/n). Default is None.

kappaint, optional

Violation batching size. If None, it is set to min(n, p). Default is None.

max_itersint, optional

Maximum number of coordinate descents. Default is int(1e5).

tolfloat, optional

Convergence tolerance. Default is 1e-7.

n_threadsint, optional

Number of threads. Default is 1.

warm_startoptional

If no warm-start is provided, the initial solution is set to the vertex of the box closest to the origin. Otherwise, the warm-start is used to extract all necessary state variables. Default is None.

Returns:
state

The resulting state after running the solver.