StatisticalRethinkingJulia / SR2TuringPluto.jl

StatisticalRethinking notebook project using Turing and Pluto notebooks (derived from Max Lapan's Jupyter project)
MIT License
98 stars 20 forks source link

`show` of MCMC.Chain summary statistics in clip-03-02-05t fails #5

Closed orialb closed 3 years ago

orialb commented 3 years ago

This line trying to show summary statistics https://github.com/StatisticalRethinkingJulia/StatisticalRethinkingTuring.jl/blob/98ee9d1efd865f5d04e5b5a42e9985add25fc7cc/notebooks/03/clip-03-02-05t.jl#L53 currently doesn't seem to work inside Pluto, at least not for me.

Similar to what was done in another notebook it can be fixed with: Text(sprint(show, "text/plain", summarize(chn)))

Do you want a PR for this?

goedman commented 3 years ago

Thanks for spotting this! Just checked it and indeed it needs the wrapping as you suggest. I've fixed it (side effect of trying it in Pluto, but it's good to leave this issue open for others).

I really need to set some time aside to update chapters 4 to 9 in StatisticalRethinkingTuring...

orialb commented 3 years ago

since it works in the REPL I wonder whether this should be considered a bug in Pluto actually? Or is it some problem with how Turing.jl defines the show method?

goedman commented 3 years ago

It's not really a bug in Pluto. It is similar to the problem with precis() and PRECIS() and in several other situations (DAGs, PSIS and WAIC). Thus, for now I sidestep the issue but realize I need to come up with a better solution. PrettyTables.jl also sometimes needs extra care. Many of these packages are also still evolving and this definitely has been the case with MCMCChains.jl (clearly at some point just chn worked), so sometimes not going to fast helps.