question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FR] get mcmc.summary() as DataFrame

See original GitHub issue

First of all thanks for the great package!

Issue Description

One of the useful features of the MCMC class is the MCMC.summary() method which prints summary statistics of the sampled chain.

In this issue I’m asking for the feature to be able to get this table as a Pandas DataFrame.

Code Snippet

def model(data):
    ...

nuts_kernel = NUTS(model)
mcmc = MCMC(nuts_kernel, num_samples=500)
mcmc.run(data)
mcmc.summary()

It would be very helpful if there was a simple way to get mcmc.summary as DataFrame or perhaps alternatively as a dict which can become a DataFrame.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
martinjankowiakcommented, Feb 2, 2022

i believe you need group_by_chain=False; please refer to the docstring for details

1reaction
fritzocommented, Jan 27, 2022

Yes @noamsgl this would be a great first contribution! You’d need to

  • implement the function
  • add a docstring
  • add a smoke test (this should be easy since pandas is already a test dependency)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Summary to pandas dataframe - numpyro
@mahdik You can use summary utility for samples from mcmc.get_samples(group_by_chain=True) to get a dict of stats.
Read more >
'MCMCvis' package
MCMCsummary is used to output summary information from MCMC output as a data.frame. All digits are reported by default. We'll use the built...
Read more >
tidy.mcmc.list: Return a tidy data summary of an MCMC object
It takes an mcmc.list object from coda.samples and return a data frame ... find with fitting a model using jags.model() , and coda.samples...
Read more >
Make chain summaries easier to extract and store #71 - GitHub
It would be nice to get that for free. The other option is just DataFrames with a 1st column of Symbols. How would...
Read more >
How to convert MCMC diagnostics to Latex table?
To find the appropriate quantities, use the names() function in R. ... mock_mcmc = mcmc(rnorm(1000)) s = summary(mock_mcmc) stats_table ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found