Skip to main content

PR Curve Slider Example

How to plot various types of metrics in W&B with custom charts
Created on May 4|Last edited on May 4

Slider example

These plots are similar to the previous section, except each set of curves is plotted once at the end of each of 10 training epochs. If you click on the gear settings icon in the top right of each chart, you will see a slider to "Select epoch". You can use this to focus each chart on a particular epoch and compare across them. Here we use the run historyTable instead of just summaryTable to get the 2D array of values logged for each epoch. An extra key for the training epoch can condition the opacity to filter the points to one epoch at a time (t_epoch in this case).

You can see the query mapping and the full Vega below the charts. Note the selection key used to create the slider and the opacity key used to condition the opacity to render one epoch at a time.




{
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "data": {
    "name": "wandb"
  },
  "selection": {

    "org": {
      "type": "single",
      "fields": ["${field:epoch}"],
      "bind": {
        "name" : "Select epoch:",
        "input": "range", 
        "min" : 0, 
        "max" : 9, 
        "step": 1}
    }
  },
  "title": "PR Curves Per Class Per Epoch",
  "mark" : { "type": "point", "filled" : true},
  "encoding": {
      "x": {
        "title" : "Recall",
        "field": "${field:x-axis}",
        "type": "quantitative"
      },
      "y": {
        "title" : "Precision",
        "field": "${field:y-axis}",
        "type": "quantitative"
      },
      "color": {
        "title" : "Nature classes",
        "field": "${field:color}",
        "type": "nominal"
      },
      "opacity" : {
        "condition" : {
          "selection" : "org", 
          "value" : 1
        },
        "value" : 0
      }
    }
  }
PR & ROC Curve
1