plot_predicted_vs_observed

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_predicted_vs_observed(y_true: ndarray, y_pred: ndarray, *, x_label: str = 'Observed', y_label: str = 'Predicted', identity: bool = True, fit_line: bool = True, annotate_r2: bool = True)[source]

Predicted-against-observed scatter with the identity line.

Points on the diagonal mean perfect agreement. Optionally overlays the least-squares fit and annotates R-squared, which together show both the bias (departure from the diagonal) and the spread.

Parameters:
  • y_true – Observed responses.

  • y_pred – Predicted responses.

  • x_label – X-axis label (sanitised).

  • y_label – Y-axis label (sanitised).

  • identity – Draw the y = x identity line.

  • fit_line – Draw the least-squares regression of predicted on observed.

  • annotate_r2 – Annotate the coefficient of determination.

Returns:

The matplotlib Figure.