probly.plot.ood.plot_pr_curve

probly.plot.ood.plot_pr_curve(recall: np.ndarray, precision: np.ndarray, aupr: float, ax: Axes | None = None, config: PlotConfig | None = None) Figure | SubFigure[source]

Plot a Precision-Recall (PR) curve.

The curve is annotated with the AUPR score in the legend. Higher curves indicate better ability to distinguish OOD from ID samples across different decision thresholds.

Parameters:
  • recall – Recall values as returned by sklearn.metrics.precision_recall_curve.

  • precision – Precision values as returned by sklearn.metrics.precision_recall_curve.

  • aupr – Area under the precision-recall curve.

  • ax – Optional pre-existing axes for subplot composition. When None a new figure is created.

  • config – Plot configuration. Defaults to PlotConfig() when None.

Returns:

The figure that contains the PR curve.

Raises:

RuntimeError – If ax is provided but has no associated figure.