Skip to main content
App version: 3.4.8

AttributeFilter

Python package: neptune-fetcher

Filter to apply to attributes when fetching runs or experiments.

Use to select specific metrics or other metadata based on various criteria.

Parameters

NameTypeDefaultDescription
name_eqUnion[str, list[str]]NoneAn attribute name or list of names to match exactly. If None, this filter is not applied.
type_inlist[Literal["float", "int", "string", "bool", "datetime", "float_series", "string_set"]]all available typesA list of allowed attribute types.
name_matches_allUnion[str, list[str]NoneA regular expression or list of expressions that the attribute name must match. If None, this filter is not applied.
name_matches_noneUnion[str, list[str]NoneA regular expression or list of expressions that the attribute names mustn't match. Attributes matching any of the regexes are excluded. If None, this filter is not applied.
aggregationslist[Literal["last", "min", "max", "average", "variance"]]["last"]List of aggregation functions to apply when fetching metrics of type FloatSeries.

Examples

Import the needed classes:

import neptune_fetcher.alpha as npt
from neptune_fetcher.alpha.filters import AttributeFilter

Constructing a filter

Select attribute by exact name:

AttributeFilter(name_eq="config/optimizer")

Select metrics not matching regexes ^test or loss$ and pick the "average" and "variance" aggregations:

AttributeFilter(
name_matches_none=[r"^test", r"loss$"],
aggregations=["average", "variance"],
)

Combine multiple filters with the pipe character:

filter_1 = AttributeFilter(...)
filter_2 = AttributeFilter(...)
filter_3 = AttributeFilter(...)
alternatives = filter_1 | filter_2 | filter_3

Using a filter

To use an attribute filter, pass it to the attributes argument of a fetching or listing method:

npt.fetch_experiments_table(
experiments=...,
attributes=AttributeFilter(...),
)

Or, if using the runs API:

from neptune_fetcher.alpha import runs


runs.fetch_runs_table(
runs=...,
attributes=AttributeFilter(...),
)