Pergunta

I'd like to use the pymc diagnostic and summary functions on samples I have generated without using pymc. As one example, I'd like to use pymc's mc_error routine on my own set of samples.

Some of the pymc diagnostic functions can take an np.array of samples, but, if I understand correctly, others seem to require a trace object. How can I convert my own set of samples into a trace object that pymc can handle? I'd appreciate any pointers.

My samples are currently stored as a dictionary where each key is a name of a variable I am sampling and points to an np.array of samples.

Thanks!

Foi útil?

Solução

Are you talking about the batchsd function? That is what is used to calculate the MC error in PyMC 2. Its located in the pymc.database.base module, and can be used on any array, really.

The pymc.diagnostics module contains all the convergence diagnostics functions, and should work on numpy arrays.

Outras dicas

For future reference, some of the PyMC* devs are spinning off a standalone package called ArviZ which includes functions for diagnosing and visualizing MCMC samples, etc. It's still under heavy development as of Fall 2018, but they currently work with xarray format, an extension to pandas for working with tensor formatted data.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top