Skip to main content
App version: 3.4.12

Histogram

Python package: neptune-scale

Represents a histogram with explicit bin edges. To specify the data distribution across bins, use either counts or densities.

Use the histogram as a value in the dictionary passed to log_histograms().

Parameters

NameTypeDescription
bin_edgesOne of:
  • numpy.ndarray
  • list of float or int
The bin edges of the histogram. The maximum number of edges is 513.
Note that n bins have n+1 bin edges, so the length of the bin_edges argument must be one more than the length of the array that specifies the counts or densities.
countsOne of:
  • numpy.ndarray
  • list of int
Number of data points that fall into each bin, as a 1D array.
densitiesOne of:
  • numpy.ndarray
  • list of float or int
Probability density function values for each bin, as a 1D array.

Examples

Define histogram using data-point counts per bin
from neptune_scale.types import Histogram


neptune_histogram = Histogram(
bin_edges=[0, 1, 40, 89, 1000],
counts=[5, 82, 44, 1],
)
Define histogram using densities
from neptune_scale.types import Histogram


neptune_histogram = Histogram(
bin_edges=[0, 1, 2, 3, 4],
densities=[0.25, 0.25, 0.25, 0.25],
)

Define histograms using NumPy:

import numpy as np


a = np.arange(5)
Counts
counts, bin_edges = np.histogram(a, density=False)
neptune_histogram = Histogram(bin_edges=bin_edges, counts=counts)
Densities
densities, bin_edges = np.histogram(a, density=True)
neptune_histogram = Histogram(bin_edges=bin_edges, densities=densities)