Log metrics
A metric can be accuracy, MSE, or any numerical value. Neptune displays all float series as charts.
from neptune_scale import Run
run = Run()
for step in epoch:
# your training loop
run.log_metrics(
data={"acc": 0.78},
step=step,
)
To log multiple metrics in a single call, pass multple key-value pairs to the data
dictionary:
run.log_metrics(
data={"loss": 0.13, "acc": 0.79},
step=step,
)
To correlate logged values, make sure to send all metadata related to a step in a single log_metrics()
call, or specify the step explicitly.
Setting custom step values
You can specify custom index values with the step
argument:
run.log_metrics(
data={"loss": 0.13, "acc": 0.79},
step=2,
)
The step
argument can be an int or float value.
Float values can be useful, for example, as substeps:
run.log_metrics(
data={"loss": 0.11, "acc": 0.81},
step=2.1,
)
Setting custom timestamp
To provide a custom timestamp, pass a Python datetime value to the timestamp
argument:
run.log_metrics(
data=...,
step=...,
timestamp=datetime.utcnow(),
)
If the timestamp
argument isn't provided, the current time is used.
If timestamp.tzinfo
is not set, the time is assumed to be in the local timezone.
Logging metrics to fork runs
When forking a run, metrics are inherited up until and including the step specified as the fork point.
For details, see Fork an experiment.