plot_max_neighbors

jaxrens.postprocess.plotting.plot_max_neighbors(monitor_or_trace, *, ax=None, kind='percentiles', run=0, percentiles=(50.0, 90.0, 100.0), show_bucket=True, **kwargs)[source]

Plot per-iteration neighbor-bucket diagnostics.

Two display modes:

  • kind="percentiles" (default): line plot showing the requested percentiles of the per-walker max_neighbor_count distribution vs iteration. Useful for “is the bucket too generous / too tight” at a glance.

  • kind="heatmap": 2-D histogram of (iteration, max_neighbor_count) densities — closest to “the distribution per iteration” requested by the user. Cell color = log-count of walkers at that (iteration, count) bin.

When show_bucket=True overlays the current bucket size as a step line — handy for spotting the gap between observed peak and the configured bucket.

Parameters:
  • monitor_or_trace – A Monitor with a non-None max_neighbors_trace or a MaxNeighborsLog instance.

  • ax (Axes | None) – Existing axes to plot into. Created if None.

  • kind (str) – "percentiles" or "heatmap".

  • run (int) – Run index for multi-run logs. Default 0 (the only entry for SingleRun).

  • percentiles (tuple[float, ...]) – Percentiles to plot when kind="percentiles". Defaults to (50, 90, 100) — median, p90, max.

  • show_bucket (bool) – Overlay the bucket-size step line.

  • **kwargs – Forwarded to ax.plot (percentiles) or ax.pcolormesh (heatmap).

Returns:

The Axes object.

Return type:

Axes