dfm / emcee3 Goto Github PK
View Code? Open in Web Editor NEWDEPRECATED: use dfm/emcee version 3 instead
Home Page: https://github.com/dfm/emcee
License: MIT License
DEPRECATED: use dfm/emcee version 3 instead
Home Page: https://github.com/dfm/emcee
License: MIT License
The README links to the docs for the old emcee. Also, the copyright statement in the readme seems out of date.
Allow a weighted list of moves to be provided to the Sampler.
This would be very useful for tuning.
Using emcee2
I get the following shapes after sampling:
sampler.chain
: (30, 100, 3)
sampler.lnprobability
: (30, 100)
Using the latest version 3.0rc2
the shapes are:
sampler.chain
: (30, 100, 3)
sampler.lnprobability
: (100, 30)
So the shape of chain
stayed the same, but new current shape of lnprobability
is not consistent anymore.
Hello to all,
I am running emcee 3.0rc2 with the "backends" feature and when i try to access the .h5 file i get the following error:
Traceback (most recent call last):
File "testing.py", line 23, in
samples = reader.get_chain(discard=burnin, flat=True)
File "/usr/local/lib/python3.6/dist-packages/emcee/backends/backend.py", line 72, in get_chain
return self.get_value("chain", **kwargs)
File "/usr/local/lib/python3.6/dist-packages/emcee/backends/hdf.py", line 101, in get_value
raise AttributeError("You must run the sampler with "
AttributeError: You must run the sampler with 'store == True' before accessing the results
The testing.py file contains the following:
reader = emcee.backends.HDFBackend('test_ff.h5')
fname = 'test_clust_1'
burnin = 1
samples = reader.get_chain(discard=burnin, flat=True)
bs = 40
labels = ['a','b','c','$\sigma_{e}$','k']
ax = corner.corner(samples,plot_contours = True, fill_contours = True,plot_datapoints = False, \ show_titles = True, bins = bs, levels = [0.,0.6827,0.9545,0.9973],labels=labels,title_fmt=".4f")
ax.savefig(fname+'.pdf')
The call of the run_emcee is done as follows:
if extra_force == "multithreading":
with multiprocessing.Pool() as pool:
sampler = emcee.EnsembleSampler(nwalkers, ndim, lnlikelihood, \ pool=pool,backend=backends)
start = tm.time()
sampler.run_mcmc(initial, states, progress=prog_bar)
end = tm.time()
multi_time = end - start
# print("Multiprocessing took {0:.1f} seconds".format(multi_time))
Is there anyone with the same problem? Perhaps I oversee something trivial.
Anyway, thanks for your time
import numpy as np
import emcee3
def lnprob(x, ivar):
return -0.5 * np.sum(ivar * x ** 2)
ndim, nwalkers = 10, 100
ivar = 1. / np.random.rand(ndim)
p0 = [np.random.rand(ndim) for i in range(nwalkers)]
model = emcee3.SimpleModel(lnprob, args=(ivar,))
# sampler = emcee3.Sampler(moves=emcee3.moves.StretchMove())
sampler = emcee3.Sampler(moves=emcee3.moves.KDEMove())
ensemble = emcee3.Ensemble(model, p0)
sampler.run(ensemble, 1000, progress=True)
chains = sampler.get_coords()
s = chains.shape
flatchain = chains.reshape(s[0] * s[1], s[2])
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.