TuringLang / MCMCChains.jl

Types and utility functions for summarizing Markov chain Monte Carlo simulations
https://turinglang.org/MCMCChains.jl/
Other
266 stars 29 forks source link

Overloading PosteriorStats methods #430

Open sethaxen opened 1 year ago

sethaxen commented 1 year ago

As discussed on the Turing Slack, MCMCChains should overload methods defined in ArviZ's PosteriorStats for Chains inputs, similar to how it overloads methods in MCMCDiagnosticTools.

This would introduce some breaking changes:

This would introduce several new functions:

~A loo method is also defined and exported by ParetoSmooth, so if loo is also exported by MCMCChains, this would cause namespace collisions. We should discuss how we want to handle this.~

EDIT: Of these functions, it probably only makes sense to overload r2_score and maybe loo_pit for Chains inputs.

cc @ParadaCarleton @devmotion

devmotion commented 1 year ago

A loo method is also defined and exported by ParetoSmooth, so if loo is also exported by MCMCChains, this would cause namespace collisions. We should discuss how we want to handle this.

julia> using MCMCChains

julia> :loo in names(MCMCChains; all=true, imported = true)
false

So loo is neither exported nor imported in MCMCChains.

sethaxen commented 1 year ago

No, loo is exported by PosteriorStats. But actually, on second thought there'd be no benefit in overloading loo for Chains, since its input is an array of log-likelihood values that wouldn't be stored in Chains anyways.