probly.plot.ood.plot_histogram

probly.plot.ood.plot_histogram(id_scores: np.ndarray, ood_scores: np.ndarray, ax: Axes | None = None, bins: int = 50, title: str = 'Score Distribution', config: PlotConfig | None = None) Figure | SubFigure[source]

Plot a density histogram comparing ID and OOD score distributions.

Two overlapping histograms are drawn — one for in-distribution scores and one for out-of-distribution scores — so the degree of overlap (and therefore the difficulty of the detection task) is immediately visible.

Parameters:
  • id_scores – Uncertainty or anomaly scores for in-distribution samples.

  • ood_scores – Uncertainty or anomaly scores for out-of-distribution samples.

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

  • bins – Number of histogram bins.

  • title – Axes title string.

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

Returns:

The figure that contains the histogram.

Raises:

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