arviz-devs / arviz_dashboard

Bayesian Dashboard built on top of Panel
Apache License 2.0
5 stars 1 forks source link

traceplot using anywidget #36

Open amaloney opened 5 months ago

amaloney commented 5 months ago
amaloney commented 2 months ago

Development has started. I was able to get anywidget to render the data_vars of the centered 8 InferenceData.

amaloney commented 2 months ago

while not a forestplot, I have an @observablehq/plot being rendered by JavaScript using anywidget to build the plot, which is of the penguins data

image

Next step is to manipulate the posterior data in JS to get the required data for a forestplot

OriolAbril commented 2 months ago

Do you want the data processing to be done in javascript? Or precomputed in python? I looked a bit at observablehq website and it wasn't clear to me how data processing happens

amaloney commented 2 months ago

I would like to try having data computations done in the browser, if they are not resource intensive. This is why the arviz.js repo exists; to handle computations that the browser can do easily, and update the plots accordingly.

amaloney commented 2 months ago

The dropdown menus didn't show when clicked (for what ever reason) but the code now parses through the posterior object to populate one dropdown with data_vars and the other dropdown with any coords associated with the selected data_var.

2024-09-12_17-22-50.webm

amaloney commented 2 months ago

Parsing through the data is going to be a challenge, and we may want to use something like DuckDB for it...maybe.

@yilinxia what are your opinions about using DuckDB vs not?

amaloney commented 2 months ago

After looking at DuckDB, I do not think we should use it as a tool since we would need to use the wasm version of it, and that seem unnecessarily heavy atm. I will continue to work on parsing the InferenceData object so we can visualize it.

yilinxia commented 2 months ago

From my experience with DuckDB, it is pretty powerful and VERY fast. But I am not fully sure how it performs in terms of the dataset we are working on.

Yeah, WASM would be a great use case for DuckDB and we possibly will use it if we plan to make the computation happens in the browser.

amaloney commented 2 months ago

Not a forest plot, but it is parsing the posterior data object and I'm able to get observable to plot a trace plot. Next step is to add interactivity with the menus so that the plot updates on changes.

image

amaloney commented 2 months ago

hooking up interactivity with the menus was a straight forward callback. Note that this will fail when there are no coordinates associated with a variable, so other checks need to be made for non-hierarchical values.

Screencast from 2024-09-13 22-00-45.webm

amaloney commented 2 months ago

I've diverged from creating a forestplot (atm) to look at interactivity etc for traceplots. Below shows the dropdowns correctly updating the figure with tooltips as you move the mouse. Next thing I'll try is getting an interactive legend.

Screencast from 2024-09-15 16-16-50.webm

amaloney commented 2 months ago

Step closer, with chains being muted. Still need to figure out how to prevent the tips from overlapping.

Screencast from 2024-09-15 22-21-22.webm

amaloney commented 1 month ago

definitely not a forestplot yet, but the posterior DataTree object is fully parsed, passed to JavaScript and menus update the figure with callbacks populating each dropdown programmatically. This is using arvizjs now, so next step is to make a KDE for this @aloctavodia @yilinxia

tagging @OriolAbril and @zaxtax if you're interested

2024-10-09 00-18-55.webm

amaloney commented 1 month ago

dropdowns are not showing, but I've decided to switch this from a forestplot to the traceplot that is functioning well. Now to apply some styling

2024-10-09_19-16-09.webm

amaloney commented 1 month ago

A few hoops to go through due to the package not being completely built from the branch, but it straight up works in colab

2024-10-09_19-55-57.webm

amaloney commented 1 month ago

Previous iterations assumed single hierarchical variables, eg a(b) and not a(b, c). This version handles that, and does not assume a set number of hierarchical variables. This can be seen when we change data from rugby to rubgy_field.

2024-10-23-17-19-30_1.webm

There are a few more items to deal with, but I'm inclined to have this reviewed in a PR.