Skip to content

Run groups#

How to switch to Group mode

With the grouping function, you can divide runs into groups by tag, configuration, or other value. You can then compare groups against each other – for example, display one graph per group on charts.

To switch from List to Group mode: In the Experiments tab, in the top left corner, click .

By default, runs are grouped by dedicated group tags. However, you can do the grouping by any field of your choice. For example, if you've logged something like run["lr"] = learning_rate to your runs, you can select the lr field to group your runs by learning rate.

The eye toggle shows the following:

  • The color of a group.
  • Whether the runs are currently visible in comparison views:
    • – all runs of the group are visible.
    • – only some of the group's runs are visible.
    • – none of the group's runs are visible.

Adding group tags#

To add a new group tag:

  • In the run menu, select Manage tags.
  • Select multiple runs (check their boxes). Then, in the bottom toolbar, select Manage groups.

You can also manage group tags via API.

Managing group tags#

Click on a group tag to bring up its menu, where you can:

  • Change the group color.
  • Toggle run matching (whether Neptune should try to apply the same color to all runs in the group).
  • Search among runs in the group.
  • Remove the tag from specific runs.
  • Apply the group tag to additional runs.
  • Delete the tag.

Matching runs#

You can toggle the Match runs setting to apply the same color to all runs within a given group.

Note

If a run belongs to multiple groups with matching turned on, the color resolves to gray.

For example, if the group tag banana is set to yellow and another group tag lime set to green, a run with both banana and lime tags is colored gray (if both tags have matching enabled).

Managing groups via API#

The groups that a run belongs to are stored as a StringSet field in the system namespace, under sys/group_tags.

You can use the add(), remove(), and clear() methods to add or remove tags from a run:

Initialize existing run and assign it to multiple groups
run = neptune.init_run(
    with_id="RUN-ID", # (1)!
    capture_hardware_metrics=False,
    capture_stderr=False,
    capture_stdout=False,
    capture_traceback=False,
    git_ref=False,
    source_code=[],
)
run["sys/group_tags"].add(["group-1", "group-2", "group-2"])
  1. RUN-ID is the Neptune ID of some existing run.
Remove a run from a group
run["sys/group_tags"].remove("group-2")
Remove a run from all groups
run["sys/group_tags"].clear()

To manage group colors or delete group tags entirely, use the Neptune web app.

Comparing runs within a group#

To compare all runs within a single group against each other:

  1. To clear the current selection, click the top eye icon ( ) directly underneath the table header and select None.
  2. Collapse the group you're interested in.
  3. Click the eye icon on that collapsed group to select all runs within.

Plotting the group mean as a single graph#

See Charts: Plot group mean as single graph →

Adding custom fields later#

To introduce a new custom field to group by, you can resume existing runs and assign new metadata fields to them.

You can reinitialize a single run as follows:

import neptune

run = neptune.init_run(with_id="RUN-ID") # (1)!

run["some_field"] = some_value
  1. RUN-ID is the Neptune ID of some existing run.

Resuming runs in bulk#

The below script illustrates how to obtain the run IDs as a list, then resume the runs one by one and log a new field (some_field).

Example script
import neptune

with neptune.init_project(project="ml-team/xnlu") as project: # (1)!
    runs_table_df = project.fetch_runs_table().to_pandas() # (2)!
    run_ids = runs_table_df["sys/id"].to_list()

for run_id in run_ids:
    with neptune.init_run(with_id=run_id) as run: # (3)!
        # some criteria for the new field or value
        run["some_field"] = some_value
  1. Initialize your project with neptune.init_project() to get a Project object that you can operate on.
  2. Use fetch_runs_table() on the project object to get a list of run IDs.
  3. Iterate through the IDs to resume each run and modify the metadata.
How do I find the ID?

You can grab the ID manually from the Experiments tab. It's displayed in the leftmost column.

Location of ID column in the experiments table of the Neptune web app

The ID is stored in the system namespace (sys/id). If the run is active, you can obtain its ID with run["sys/id"].fetch(). For example:

>>> run = neptune.init_run(project="ml-team/classification")
>>> run["sys/id"].fetch()
'CLS-26'

Depending on the field and value you want to introduce, you can implement some checks or other criteria in order to determine what metadata to assign to the run.