adelie.diagnostic.plot_kkt#
- adelie.diagnostic.plot_kkt(lmdas: ndarray, scores: ndarray, *, idx: int | None = None, relative: bool = False)[source]#
Plots KKT failures.
This function only plots a subset of the scores. Specifically (assuming
idx
is notNone
), if there aren
number of scores inscores[idx]
above the thresholdlmdas[idx]
, then thesen
scores as well as then
largest scores below the threshold are shown. Ifidx
isNone
, then the same plot is drawn at every index as an animation.- Parameters:
- lmdas(L,) ndarray
Regularization parameters \(\lambda\).
- scores(L, G) ndarray
Gradient scores.
- idxint, optional
Index of
lmdas
andscores
at which to plot the KKT failures. IfNone
, then an animation of the plots at every index is shown. Default isNone
.- relativebool, optional
If
True
, then plots the relative errorscore / lmda[:, None] - 1
. Otherwise, the absolute values are used. Default isFalse
.
- Returns:
- fig, ax
If
idx
is notNone
, then a figure and axes is returned.- anim
If
idx
isNone
, then an animation of the plots is returned.