adelie.diagnostic.gradient_scores#

adelie.diagnostic.gradient_scores(grad_norms: ndarray, lmdas: ndarray, *, alpha: float = 1, penalty: ndarray | None = None)[source]#

Computes the gradient scores.

The gradient score is given by

\[\begin{split}\begin{align*} \hat{s}_g = \begin{cases} \hat{h}_g \cdot (\alpha p_g)^{-1} ,& \alpha p_g > 0 \\ \lambda ,& \alpha p_g = 0 \end{cases} \qquad g = 1,\ldots, G \end{align*}\end{split}\]

where \(\hat{h}\) is the gradient norm as in adelie.diagnostic.gradient_norms().

Parameters:
grad_norms(L, G) ndarray

Gradient norms.

lmdas(L,) ndarray

Regularization parameters \(\lambda\).

penalty(G,) ndarray

Penalty factor for each group. It must be a non-negative vector.

alphafloat, optional

Elastic net parameter \(\alpha\). It must be in the range \([0,1]\). Default is 1.

Returns:
scores(L, G) ndarray

Gradient scores.