Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple lines on same plot with incremental logging - wandb

I am using weights & biases (wandb). I want to group multiple plots into one while using incremental logging, any way to do that?

Say we have 10 metrics, I can add them to the project incrementally, gradually building 10 graphs:

import wandb
import math

N_STEPS = 100

wandb.init(project="someProject", name="testMultipleLines")
for epoch in range(N_STEPS):
    log = {}
    log['main_metric'] = epoch / N_STEPS  # some main metric

    # some other metrics I want to have all on 1 plot
    other_metrics = {}
    for j in range(10):
        other_metrics[f'metric_{j}'] = math.sin(j * math.pi * (epoch / N_STEPS))
    log['other_metrics'] = other_metrics

    wandb.log(log)

This by default gets presented on the wandb interface as 11 different plots. How can they be grouped through the API (without using the web interface) such that main_metric is on one figure and all other_metrics are bunched together on a second figure?

like image 675
Julep Avatar asked Aug 15 '26 00:08

Julep


1 Answers

I think this can be done using the web interface (by adding a panel and making new plots with different y keys) but I am not sure how this can be integrated into code.

like image 145
Megh Avatar answered Aug 17 '26 14:08

Megh