Skip to content

Histogram

Histogram(
sequence: Any = None,
np_histogram: tuple | None = None,
num_bins: int = 64
) -> None

Wraps histogram data for logging. Compatible with wandb.Histogram.

Pass either a raw sequence (list, array) which is binned automatically, or a pre-computed numpy histogram tuple.

  • sequence — Any array-like data (list, numpy array, etc.). Automatically binned into num_bins bins using numpy.histogram.
  • np_histogram — Pre-computed histogram as a (counts, bin_edges) tuple, matching the output of numpy.histogram().
  • num_bins — Number of bins when computing from sequence. Default 64. Capped at MAX_BINS (512).
  • counts — List of bin counts.
  • bin_edges — List of bin edges (length = len(counts) + 1).
  • ValueError — If neither sequence nor np_histogram is provided, or if bin_edges length doesn’t match counts length + 1.