Need help with the .filter command

I am having trouble using the filter command. In this picture I have a runs.summary of one of my uploaded tables, I see that a .filter command exists but I haven’t found a good example of the syntax required to use it. I have a column named category that defines whether each row represents a baseline, statistical, or ML model. I would like to be able to filter by these categories.

It would also be helpful if I knew how to filter by this column when creating a custom chart, but I’m not sure if this is possible.

Hi there,
Thanks for your question and sorry you weren’t able to find a solution in our docs.
That is a “Weave Expression” and you can filter it with this command:
runs.summary["table"].table.rows.concat.filter((row) => row['<column>'] == '<something>')
where and are the values you want to filter by.

Some caveats:

  • This is already filtered to show the runs that are selected in your workspace.
  • This is limited to the first 50 runs in the workspace
  • You can filter runs in your workspace using the :eye: icon or using the filter button above the run names
  • You can also filter the table by clicking the filter button ▼ in the top left of the panel and typing row['<column>'] == '<something>'

I was able to get filter working using this instruction

  • You can also filter the table by clicking the filter button ▼ in the top left of the panel and typing row['<column>'] == '<something>'

This is what I have

row[“ModelCategory”] == “ml”

However, I was unable to get it working using this

runs.summary[“table”].filter((row) => row[‘’] == ‘’)

I tried:
runs.summary[“table”].filter((row) => row[“ModelCategory”] == “ml”)

This would be my preferred way of doing it as the first implementation only works in table form, while I want to make plots using the filtered table.

Sorry, I was incorrect above.
run.summary['table name'] is actually a list of Table files under the hood so you can’t filter using it’s contents directly.
To filter using it’s contents, you can do:
runs.summary["table name"].table.rows.concat.filter((row) => row['column name'] == 'something')

We’re actively working on improving the UX and documentation of this, thanks for your patience.

Is there a way to do a similar type of filtering from this screen?

Hey @svedder! You can filter Cusom Charts by modifying the Vega spec. Here you have their official docs. You need to click on Edit and then add the filter to the spec as shown in this screenshot

And you can create a new preset by clicking on Detach or save the existing preset by clicking on Publish changes. Please let me know if this is helpful!

Yes, very helpful! Do you know where to aggregate to metrics together from this screen? For example on my x-axis I want the sum of bias and error

Hey @svedder, you can do that by computing a new metric like:

      "calculate": "datum['${field:bias}'] + datum['${field:error}']",
      "as": "x"

Take a look at this project for an example

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.