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.

Added support for emcee in arviz

See original GitHub issue

Wanted to let you know we have added support for emcee to the arviz library - see https://github.com/arviz-devs/arviz/pull/302 for a description of the change.

Roughly, the plan is for arviz to replace plotting and diagnostics for pymc3 (so we do not have to rewrite it for pymc4), by converting data to a common data format (netCDF/xarray datasets), and then implementing all the plots and diagnostics on that object. emcee is the third library to have support (pymc3 and pystan), after hearing so many astronomers saying nice things about it at a conference.

In addition to the plots you can see in the pull request above, you can also calculate things like the effective sample size and the gelman rubin statistic. The summary function below shows a number of these.

Some questions I had -

  • we store sample_stats from pystan and pymc3. Is there a way to access whether a sample was accepted at a per-draw basis in emcee?
  • Are there particular diagnostics or plots you would like to see?
import arviz as az
from arviz.tests import helpers

sampler = helpers.emcee_linear_model(None, 500, 10)  # this is the sampler from http://dfm.io/emcee/current/user/line/

# This converter turns the data into a netCDF object that can be serialized and shared
data = az.from_emcee(sampler, var_names=['ln(f)', 'b', 'm'])

# all arviz functions should work with this object
az.summary(data).to_dataframe()
ln(f) b m
metric
mean -0.901523 4.186736 -0.493168
standard deviation 0.083640 0.387793 0.146651
mc error 0.002052 0.008238 0.003727
hpd 3.00% -1.061138 3.448212 -0.759357
hpd 97.00% -0.742526 4.923531 -0.201992
effective samples 1429.248983 1408.863122 1287.373414
gelman-rubin statistic 1.030000 1.030000 1.040000

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
dfmcommented, Oct 1, 2018

I haven’t tested it thoroughly, but the assumptions are not satisfied. I’d recommend checking out this blog post for more discussion and recommended methods for ensemble methods: https://dfm.io/posts/autocorr/

0reactions
nedahejazicommented, May 26, 2021

Hello, I seriously need help with emcee. I am trying to fit model spectra to observed ones. After working hard on code, the results are very strange. The chain values of parameters are the same for each walker. I mean the initial values do not change over the chain. Do you have any clue? If needed, I can send the code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

arviz.from_emcee — ArviZ dev documentation
Convert emcee data into an InferenceData object. For a usage example read Converting emcee objects to InferenceData. Parameters. sampleremcee.EnsembleSampler.
Read more >
Converting emcee objects to InferenceData — ArviZ dev ...
Below are various ways to generate an InferenceData from emcee objects. ... ArviZ has support for multidimensional variables, and there is a way...
Read more >
arviz-devs/GSoC - Gitter
Adding new features to any of the 3 modules will always require a base knowledge of bayesian modeling as well as general ArviZ...
Read more >
2022-05-25 Wed meeting - HackMD
Jiawen: cofi - working on emcee, now a basic example works, but there are a few things that ... corner.py also has arviz...
Read more >
About Me - Oriol unraveled
I am a core contributor of ArviZ a project for exploratory analysis of Bayesian ... since I was little and more recently I...
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