Skip to main content
App version: 3.4.15

log_histograms()

Python package: neptune-scale

Logs the specified histograms at a particular step.

Parameters

histograms
dict[str, Histogram]
required

A dictionary with attribute paths as keys and histogram objects as values.

step
float | int
required

Index of the series entry. Using float rather than int values can be useful, for example, when logging substeps in a batch.

datetime
float | int
optional

Time of logging the histograms at the specified step. If not provided, the current time is used. If provided, and timestamp.tzinfo is not set, the local timezone is used.

Examples

Log a single histogram series per step
from neptune_scale import Run
from neptune_scale.types import Histogram


run = Run(...)

for step in epoch:
# your training loop

my_histogram = Histogram(
bin_edges=[0, 1, 40, 89, 1000],
counts=[5, 82, 44, 1],
)

run.log_histograms(
histograms={
"layers/1/activations": my_histogram
},
step=1,
)
Log multiple histogram series per step
for step in epoch:
# your training loop

my_histogram_1 = Histogram(
bin_edges=[0, 1, 2, 3, 4],
densities=[0.25, 0.25, 0.25, 0.25],
)
my_histogram_2 = Histogram(...)
my_histogram_3 = Histogram(...)

run.log_histograms(
histograms={
"layers/1/activations": my_histogram_1,
"layers/2/activations": my_histogram_2,
"layers/3/activations": my_histogram_3,
},
step=step,
)