fetch_metrics()
Fetches a table of metric values per step.
The values are raw, without any aggregation, approximation, or interpolation.
To narrow the results, limit the step range or the number of values from the tail end. You can also define filters for experiments to search or attributes to include.
Fetch experiment metrics
You can filter the results by:
- Experiments: Specify which experiments to search.
- Attributes: Only list attributes that match certain criteria.
Parameters
Returns
pandas.DataFrame – A table of metric values per step. The DataFrame has a MultiIndex with:
- Index:
["experiment", "step"]for experiments or["run", "step"]for runs - Columns: attribute names with the following sub-columns:
"value"– metric values"absolute_time"if theinclude_timeargument is set to"absolute""is_preview"if theinclude_point_previewsargument is set toTrue"preview_completion"if theinclude_point_previewsargument is set toTrue
Raises
AttributeTypeInferenceError– If the attribute type wasn't specified in a filter passed to theexperimentsargument, and the attribute has multiple types across the project's experiments.ConflictingAttributeTypes– If there are conflicting attribute types under the same path and thetype_suffix_in_column_namesargument is set toFalse.
Examples
Fetch the last 12 values of a specific experiment's losses and accuracies, including incomplete points:
import neptune_query as nq
nq.fetch_metrics(
experiments=["seabird-4"],
attributes=r"loss | acc",
tail_limit=12,
include_point_previews=True,
)
accuracy loss
is_preview preview_completion value is_preview preview_completion value
experiment step
seabird-4 37.0 False 1.000000 0.822683 False 1.000000 0.192384
38.0 False 1.000000 0.821014 False 1.000000 0.200655
39.0 False 1.000000 0.800180 False 1.000000 0.181736
41.0 True 0.756098 0.813834 True 0.756098 0.178080
42.0 True 0.761905 0.802206 True 0.761905 0.178129
43.0 True 0.767442 0.822235 True 0.767442 0.192478
44.0 True 0.772727 0.809570 True 0.772727 0.192476
45.0 True 0.777778 0.817433 True 0.777778 0.191994
46.0 True 0.782609 0.802809 True 0.782609 0.186171
47.0 True 0.787234 0.803025 True 0.787234 0.196133
48.0 True 0.791667 0.820802 True 0.791667 0.188257
49.0 True 0.795918 0.821936 True 0.795918 0.182162
Fetch the last 15 values of a specific experiment's losses, including all extra information:
nq.fetch_metrics(
experiments=["seabird-4"],
attributes=r"loss",
tail_limit=15,
include_time="absolute",
type_suffix_in_column_names=True,
include_point_previews=True,
)
loss:float_series
absolute_time is_preview preview_completion value
experiment step
seabird-4 34.0 2025-08-29 09:18:27.875000+00:00 False 1.000000 0.184275
35.0 2025-08-29 09:18:27.884000+00:00 False 1.000000 0.191002
36.0 2025-08-29 09:18:27.888000+00:00 False 1.000000 0.197030
37.0 2025-08-29 09:18:27.891000+00:00 False 1.000000 0.192384
38.0 2025-08-29 09:18:27.895000+00:00 False 1.000000 0.200655
39.0 2025-08-29 09:18:27.899000+00:00 False 1.000000 0.181736
41.0 2025-08-29 09:18:27.902000+00:00 True 0.756098 0.178080
42.0 2025-08-29 09:18:27.902000+00:00 True 0.761905 0.178129
43.0 2025-08-29 09:18:27.916000+00:00 True 0.767442 0.192478
44.0 2025-08-29 09:18:27.920000+00:00 True 0.772727 0.192476
45.0 2025-08-29 09:18:27.925000+00:00 True 0.777778 0.191994
46.0 2025-08-29 09:18:27.929000+00:00 True 0.782609 0.186171
47.0 2025-08-29 09:18:27.934000+00:00 True 0.787234 0.196133
48.0 2025-08-29 09:18:27.934000+00:00 True 0.791667 0.188257
49.0 2025-08-29 09:18:27.942000+00:00 True 0.795918 0.182162
Fetch from runs
To target individual runs by ID instead of experiment name, import the runs API:
import neptune_query.runs as nq_runs
Then call the corresponding querying method and replace the experiments parameter with runs:
nq_runs.fetch_metrics(
runs=["prompt-wolf-20250605132116671-2g2r1"], # run ID
attributes=r"^loss/.*",
step_range=(1000.0, None),
include_point_previews=True,
)