Skip to content
Snippets Groups Projects

Add a mean-log-likelihood method to improve the ACT estimation

Merged Gregory Ashton requested to merge add-mean-log-like-to-ptemcee into master
All threads resolved!
Compare and Show latest version
1 file
+ 5
2
Compare changes
  • Side-by-side
  • Inline
@@ -369,7 +369,7 @@ class Ptemcee(MCMCSampler):
return pos0
def setup_sampler(self):
""" Either initialize the sampelr or read in the resume file """
""" Either initialize the sampler or read in the resume file """
import ptemcee
if os.path.isfile(self.resume_file) and self.resume is True:
@@ -617,6 +617,7 @@ class Ptemcee(MCMCSampler):
self.search_parameter_keys,
self.resume_file,
self.log_likelihood_array,
self.log_posterior_array,
self.chain_array,
self.pos0,
self.beta_list,
@@ -951,6 +952,7 @@ def checkpoint(
search_parameter_keys,
resume_file,
log_likelihood_array,
log_posterior_array,
chain_array,
pos0,
beta_list,
@@ -984,6 +986,7 @@ def checkpoint(
Q_list=Q_list,
time_per_check=time_per_check,
log_likelihood_array=log_likelihood_array,
log_posterior_array=log_posterior_array,
chain_array=chain_array,
pos0=pos0,
)
@@ -1070,7 +1073,7 @@ def plot_mean_log_posterior(mean_log_posterior, outdir, label):
fig, ax = plt.subplots()
idxs = np.arange(nsteps)
ax.plot(idxs, mean_log_posterior.T)
ax.set(xlabel="Iteration", ylabel=r"$\langle\log\mathcal{L}\rangle$",
ax.set(xlabel="Iteration", ylabel=r"$\langle\mathrm{log-posterior}\rangle$",
ylim=(ymin, ymax))
fig.tight_layout()
fig.savefig("{}/{}_checkpoint_meanlogposterior.png".format(outdir, label))
Loading