metrics#

SuperGLM.metrics(
X: FrameLike,
y: NDArray,
sample_weight: NDArray | None = None,
offset: NDArray | None = None,
) → ModelMetrics#

Compute comprehensive diagnostics for the fitted model.

The deviance, likelihoods, Pearson statistic and residuals() are computed from the model’s predictions on X, the values predict returns. They do not depend on object identity: equal copies of the training data and a saved and reloaded model give the same values as the objects the model was fitted on. Leverage-based diagnostics do depend on it. On the fit’s own objects, leverage, the standardized residuals and Cook’s distance read the fit’s own geometry; see the ModelMetrics notes.

summary() instead reports the fit’s own statistics from its fitting design. On a discrete=True fit that design is the binned one, so the two differ slightly on the training data.

Raises:
NoPredictedMeanError

A ValueError naming the rows of positive weight that predict() gives no mean (NaN), such as rows past an inverse link’s eta = 0: no deviance or likelihood exists for them. Give those rows weight zero or leave them out; a zero-weight row is scored as before, its residuals and Cook’s distance read NaN, and eta reports its raw linear predictor.