Skip to main content
App version: 3.4.8

fetch_metrics()

Python package: neptune-fetcher

Returns raw values for the requested metrics. The returned values don't include any aggregation, approximation, or interpolation.

Fetch experiment metrics

You can filter the results by:

  • Experiments: Specify which experiments to search.
  • Attributes: Only list attributes that match certain criteria.

Parameters

NameTypeDefaultDescription
experimentsUnion[str, Filter]-A filter specifying which experiments to include:
  • a regex that the experiment name must match, or
  • a Filter object.
attributesUnion[str, AttributeFilter]-A filter specifying which attributes to include in the table:
  • a regex that the attribute name must match, or
  • an AttributeFilter object.
If AttributeFilter.aggregations is set, an exception will be raised as they're not supported in this function.
include_timeLiteral["absolute"], optionalNoneWhether to include absolute timestamp. If set, each metric column has an additional sub-column with requested timestamp values.
step_rangeTuple[float, float]NoneA tuple specifying the range of steps to include. Can represent an open interval.
lineage_to_the_rootboolTrueIf True, includes all points from the complete experiment history. If False, only includes points from the selected experiment.
tail_limitint, optionalNoneFrom the tail end of each series, how many points to include at most.
type_suffix_in_column_namesboolFalseIf True, columns of the returned DataFrame will be suffixed with ":<type>". For example: "attribute1:float_series", "attribute1:string". If set to False, the method throws an exception if there are multiple types under one path.
include_point_previewsbool, optionalFalseIf set to True, metric previews are included in the fetched data frame.
contextContext, optionalNoneWhich project and API token to use for the fetching operation. Useful for switching projects.

Example

Fetch loss metrics from experiments matching a regex, including point previews and only values logged from step 1000 onward:

import neptune_fetcher.alpha as npt


npt.fetch_metrics(
experiments=r"seagull.*_estimated$",
attributes=r"^loss/.*",
step_range=(1000.0, None),
include_point_previews=True,
)
Output
                            path     loss/train
is_preview preview_completion value
experiment step
seagull-45xc099_estimated 1000.0 False 1.0 0.193153
1001.0 False 1.0 0.166237
1002.0 False 1.0 0.12602
...

Fetch run metrics

You can filter the results by:

  • Runs: Specify which runs to search.
  • Attributes: Only list attributes that match certain criteria.

Parameters

NameTypeDefaultDescription
runsUnion[str, Filter]-A filter specifying which runs to include:
  • a regex that the run ID must match, or
  • a Filter object.
attributesUnion[str, AttributeFilter]-A filter specifying which attributes to include in the table:
  • a regex that the attribute name must match, or
  • an AttributeFilter object.
If AttributeFilter.aggregations is set, an exception will be raised as they're not supported in this function.
include_timeLiteral["absolute"], optionalNoneWhether to include absolute timestamp. If set, each metric column has an additional sub-column with requested timestamp values.
step_rangeTuple[float, float]NoneA tuple specifying the range of steps to include. Can represent an open interval.
lineage_to_the_rootboolTrueIf True, includes all points from the complete run history. If False, only includes points from the selected runs.
tail_limitint, optionalNoneFrom the tail end of each series, how many points to include at most.
type_suffix_in_column_namesboolFalseIf True, columns of the returned DataFrame will be suffixed with ":<type>". For example: "attribute1:float_series", "attribute1:string". If set to False, the method throws an exception if there are multiple types under one path.
include_point_previewsbool, optionalFalseIf set to True, metric previews are included in the fetched data frame.
contextContext, optionalNoneWhich project and API token to use for the fetching operation. Useful for switching projects.

Example

Fetch accuracy metrics from runs matching a regex, including the last 3 values from each series:

from neptune_fetcher.alpha import runs


runs.fetch_metrics(
runs=r"marigold",
attributes=r"accuracy",
tail_limit=3,
)
Output
                                    accuracy
run step
arrogant-millipede+marigold-finch 49.0 0.830062
50.0 0.828428
51.0 0.825925
marigold-finch+realistic-dolphin 31.0 0.970358
32.0 0.986717
33.0 0.971492
marigold-finch+thundering-mantis 29.0 0.925642
30.0 0.963742
31.0 0.970358