adelie.diagnostic.coefficient#

adelie.diagnostic.coefficient(lmda: float, betas: csr_matrix, intercepts: ndarray, lmdas: ndarray)[source]#

Computes the coefficient at \(\lambda\) using linear interpolation of solutions.

The linearly interpolated coefficient is given by

\[\begin{align*} \hat{\beta}(\lambda) = \frac{\lambda - \lambda_{k+1}}{\lambda_{k} - \lambda_{k+1}} \hat{\beta}(\lambda_k) + \frac{\lambda_{k} - \lambda}{\lambda_{k} - \lambda_{k+1}} \hat{\beta}(\lambda_{k+1}) \end{align*}\]

if \(\lambda \in [\lambda_{k+1}, \lambda_k]\). If \(\lambda\) lies above the largest value in lmdas or below the smallest value, then we simply take the solution at the respective ends. The same formula holds for intercepts.

Parameters:
lmdafloat

New regularization parameter at which to find the solution.

betas(L, p) csr_matrix

Coefficient vectors \(\beta\).

intercepts(L,) ndarray

Intercepts.

lmdas(L,) ndarray

Regularization parameters \(\lambda\).

Returns:
beta(1, p) csr_matrix

Linearly interpolated coefficient vector at \(\lambda\).

interceptfloat

Linearly interpolated intercept at \(\lambda\).