plot_residuals

Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

plot_residuals(y_true: ndarray, y_pred: ndarray, *, x_label: str = 'Fitted value', y_label: str = 'Residual')[source]

Residuals against fitted values, to expose heteroscedasticity and bias.

A well-behaved model shows a mean-zero cloud with no funnel or trend; a curved or fan-shaped pattern signals a missing term or non-constant variance.

Parameters:
  • y_true – Observed responses.

  • y_pred – Predicted responses.

  • x_label – X-axis label (sanitised).

  • y_label – Y-axis label (sanitised).

Returns:

The matplotlib Figure.