Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support conversion of NamedTuple-based samples to InferenceData #4

Closed
sethaxen opened this issue Nov 11, 2019 · 3 comments
Closed

Support conversion of NamedTuple-based samples to InferenceData #4

sethaxen opened this issue Nov 11, 2019 · 3 comments

Comments

@sethaxen
Copy link
Member

sethaxen commented Nov 11, 2019

Several PPLs/samplers that don't use MCMCChains.Chains to store samples (e.g. DynamicHMC.jl and Soss.jl) instead return the samplers as a vector of NamedTuples (or a vector of such vectors if multiple chains are obtained). We should provide functionality for converting these data types into InferenceData. As a side-effect, this would add more support for Turing, since currently posterior predictive samples from Turing will usually be in NamedTuples instead of Chains.

@cscherrer
Copy link

cc @tpapp

@cscherrer
Copy link

Soss doesn't have a standard format, but uses whatever the inference engine produces. For simplicity, I sometimes post-process this to end up with either an array of named tuples or a named tuple of particles (see MonteCarloMeasurements.jl). I also have some iterator support, but that's not pinned sudden enough yet for a design spec.

@chriselrod what format are you using for ProbabilityModels.jl output?

@sethaxen
Copy link
Member Author

I'd like to keep the number of supported convertors to a minimal few for now. NamedTuple, Vector{NamedTuple}, Dict, and AbstractChains will probably be all for the moment. Ideally, MCMCChains would support non-numeric types (I don't know if it does) and multivariate types without flattening like it currently does.

ArviZ's InferenceData wrap a collection of xarray.Dataset. Dataset is quite nice and very general. It's basically a collection of named arrays with named dimensions and indices. It would be nice to have something like that in its own package and just handle conversion from that type to arviz.InferenceData in this package. It's probably best to hold off on this until Julia's dimension/index naming ecosystem settles down a bit (see e.g. JuliaCollections/AxisArraysFuture#1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants