Skip to main content

Table Comparisons

Created on February 16|Last edited on September 12

Tables Overview:

Tables are a special wandb Data Type, which allow you to log data, including other wandb Data Types, into an interactive dataframe in the workspace. This is especially useful for logging model predictions in order to filter them and inspect errors. To log a table you can add data row-by-row or as a pandas dataframe or Python lists. The elements of the dataframe can be any wandb Data Type (e.g. wandb.Image, wandb.Html, wandb.Plotly) or simple scalar or text values:
# Add data as a list of lists or pandas dataframe
my_data = [
[0, wandb.Image("img_0.jpg"), 0, 0],
[1, wandb.Image("img_1.jpg"), 8, 0],
[2, wandb.Image("img_2.jpg"), 7, 1],
[3, wandb.Image("img_3.jpg"), 1, 1]
]
# create a wandb.Table() with corresponding columns
columns=["id", "image", "prediction", "truth"]
test_table = wandb.Table(data=my_data, columns=columns)

# Add data incrementally
for img_id, img in enumerate(mnist_test_data):
true_label = mnist_test_data_labels[img_id]
guess_label = my_model.predict(img)
test_table.add_data(img_id, wandb.Image(img), \
guess_label, true_label)

wandb.log({"test_table": test_table})
Use tables to log validation, sample predictions, or model errors, not entire training datasets. They can handle up to 200k rows but UI performance will vary depending on how many rich media types you have embedded. Here is a comprehensive guide to logging tables.

Table Versions

When logging tables you will see in the workspace wandb.summary["my_table_name"] like below. This is using a weave expression to query logged data in W&B and render it appropriately. Read more about weave here. The upshot for right now is that W&B by default only renders the last version of a table (the summary one) logged in a run. So if you are logging tables multiple times throughout a run, you will only see the last one by default.

Concatenating All Table Versions

  1. Concatenate all table versions into a single table using the weave expression runs.loggedArtifactVersions.flatten.file("<my_table_name>".table.json")
  2. You must log the iteration number (e.g. epoch) as a column in the table if you want to be able to filter/group by that variable
  3. You can add the run name as a column to the table by hovering over a column and "Insert Right" or "Insert Left" -> "row.run.name"

Run set
29


Put your different table versions side-by-side in a Panel Grid:

  • You can also access the different table versions separately and make panel grids for each version:

Run set
29