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 not None), if there are n number of scores in scores[idx] above the threshold lmdas[idx], then these n scores as well as the n largest scores below the threshold are shown. If idx is None, 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 and scores at which to plot the KKT failures. If None, then an animation of the plots at every index is shown. Default is None.

relativebool, optional

If True, then plots the relative error score / lmda[:, None] - 1. Otherwise, the absolute values are used. Default is False.

Returns:
fig, ax

If idx is not None, then a figure and axes is returned.

anim

If idx is None, then an animation of the plots is returned.