theogf / Turkie.jl

Turing + Makie = Turkie
MIT License
68 stars 6 forks source link

Turkie in Pluto #38

Open eford opened 2 years ago

eford commented 2 years ago

Very nice idea. I tried the README's small example in Pluto (both as written and using WGLMakie instead of GLMakie). It opened a new browser tab that stayed empty until the chain was done. If I clicked reload, then it would show the final plot. If I called sample a second time, then the plots in the other browser tab would update. However, it was ~10x slower than running the sampler without the callback.
Are these a known limitations? Or am I misusing Turkie?

theogf commented 2 years ago

I never tried in Pluto, but I think it should just work out of the box. Since a new browser tab it sounds like there might be some issue with the output of the figure, I am honestly not sure how it should work with interactions... What you could try is to display the TurkieCallback object in a separate cell and see what happens...

ianfiske commented 2 years ago

I found that if I just place

cb.figure

in a separate cell, I do get a full chart. It does not update as the sampler updates as an online plot, but is a static plot of the results. Still, it's quite useful -- thanks for the package! I'm not sure how one could coordinate the interactivity between Pluto and the online plotting here, but I imagine something from http://juliaplots.org/WGLMakie.jl/stable/ might work.

theogf commented 2 years ago

Maybe @fonsp knows more about interactions between Makie and Pluto especially with Observables

fonsp commented 2 years ago

They don't really interact right now because the two paradigms don't fit together easily. There might be a possibility to link Observables into Pluto's model using https://github.com/JuliaPluto/PlutoHooks.jl, but the main problem to solve first is stability of WGLMakie inside Pluto.

fonsp commented 2 years ago

Rendering to a video and displaying it with PlutoUI.LocalResource might be the easiest way to get it working inside Pluto :)

eford commented 2 years ago

The motivation is that we want to be able to visualize the current state of a long-running calculation, so we can interrupt it if we realize it's not going to end well or decide to go to sleep if we can tell it will need at least a few more hours to finish. So waiting until the calculation is done and making a movie wouldn't achieve the goal.

On Fri, Dec 17, 2021 at 6:52 PM Fons van der Plas @.***> wrote:

Rendering to a video and displaying it with PlutoUI.LocalResource might be the easiest way to get it working inside Pluto :)

— Reply to this email directly, view it on GitHub https://github.com/theogf/Turkie.jl/issues/38#issuecomment-997096214, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKDFQWQJEYYZV2MGMANUBLURPEMHANCNFSM5CGFMW2Q . You are receiving this because you authored the thread.Message ID: @.***>

-- Eric Ford