0

I've used the following code to log a metric

wandb.log({"metric": [4, 5, 6]})

but then found out that Wandb doesn't support plotting a list by default. I want to create a line plot where the y-axis is the first element of the metric array, and the x-axis is the step.

I've read the Custom Charts section of the document. I think I should use Vega to access the first element of the array. Here are the steps that I've taken: For the custom chart, I've set the data source as "history" and selected the "metric" key.

query {
    runSets
         (runSets: "${runSets}" ) {
            id
            name
            history
                (keys: ["metric" ] )
        }
}

In the Vega script, I tried to flatten the array, using this part of the documentation

"transform": {
    ...
    {"type": "flatten", "fields": ["${field:metric}"]},
}

This gives me a warning that "type" and "fields" arguments are not allowed, which means I should include this flattening block somewhere else (not in the transform section). I'm afraid I don't know where, and how I can achieve this. Is this even possible? If not, I think in my notebook I should write a script that accesses the wandb.run log data, and transform the data for each run. if so, any tips for that solution is also appreciated.

Danial
  • 362
  • 4
  • 18

1 Answers1

0

Question, if you want to plot against the step, why not creating 3 metrics?

wandb.log({"metric1":4,
           "metric2":5,
           "metric3":6})

You can then combine the plots as you see fit into a plot panel.

tcapelle
  • 442
  • 3
  • 12
  • That is indeed the correct way, but my problem was that I had already used the mentioned format to log a very long run. I didn't want to train my model all over again, just to correct the log format. – Danial Jul 11 '23 at 07:59