aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2020-05-31 11:57:35 -0500
committertlatorre <tlatorre@uchicago.edu>2020-05-31 11:57:35 -0500
commit00dacd206e5ff3798b7b34c359dda644e8f767b5 (patch)
treeee6518e56c38e1d6d1e9b10c77718dbc0ebcca0a
parentd46e6c04c61cc9774a0ddede53092a7c66a8a273 (diff)
downloadsddm-00dacd206e5ff3798b7b34c359dda644e8f767b5.tar.gz
sddm-00dacd206e5ff3798b7b34c359dda644e8f767b5.tar.bz2
sddm-00dacd206e5ff3798b7b34c359dda644e8f767b5.zip
update contamination analysis step size
This commit updates the step size used for the MCMC in the contamination analysis to 0.5 times the error returned by scanning near the minimum. I ran some tests and this seemed to be pretty efficient compared to either the full error or 0.1 times the error. I also reduced the number of workers to 10.
-rwxr-xr-xutils/dc4
-rwxr-xr-xutils/dc-closure-test4
2 files changed, 4 insertions, 4 deletions
diff --git a/utils/dc b/utils/dc
index 8227e99..b36579e 100755
--- a/utils/dc
+++ b/utils/dc
@@ -453,7 +453,7 @@ if __name__ == '__main__':
#samples = metropolis_hastings(nll,xopt,stepsizes,100000)
#print("nll(xopt) = %.2g" % nll(xopt))
- pos = np.empty((100, len(x0)),dtype=np.double)
+ pos = np.empty((10, len(x0)),dtype=np.double)
for i in range(pos.shape[0]):
pos[i] = xopt + np.random.randn(len(x0))*stepsizes
pos[i,:6] = np.clip(pos[i,:6],EPSILON,1e9)
@@ -465,7 +465,7 @@ if __name__ == '__main__':
nwalkers, ndim = pos.shape
- proposal = get_proposal_func(stepsizes,low,high)
+ proposal = get_proposal_func(stepsizes*0.5,low,high)
sampler = emcee.EnsembleSampler(nwalkers, ndim, lambda x, grad, fill_value: -nll(x,grad,fill_value), moves=emcee.moves.MHMove(proposal),args=[None,np.inf])
with np.errstate(invalid='ignore'):
sampler.run_mcmc(pos, args.steps)
diff --git a/utils/dc-closure-test b/utils/dc-closure-test
index 45c0f6e..43d26d3 100755
--- a/utils/dc-closure-test
+++ b/utils/dc-closure-test
@@ -383,7 +383,7 @@ def fit(data, sacrifice, steps):
#samples = metropolis_hastings(nll,xopt,stepsizes,100000)
#print("nll(xopt) = %.2g" % nll(xopt))
- pos = np.empty((100, len(x0)),dtype=np.double)
+ pos = np.empty((10, len(x0)),dtype=np.double)
for i in range(pos.shape[0]):
pos[i] = xopt + np.random.randn(len(x0))*stepsizes
pos[i,:6] = np.clip(pos[i,:6],EPSILON,1e9)
@@ -395,7 +395,7 @@ def fit(data, sacrifice, steps):
nwalkers, ndim = pos.shape
- proposal = get_proposal_func(stepsizes,low,high)
+ proposal = get_proposal_func(stepsizes*0.5,low,high)
sampler = emcee.EnsembleSampler(nwalkers, ndim, lambda x, grad, fill_value: -nll(x,grad,fill_value), moves=emcee.moves.MHMove(proposal),args=[None,np.inf])
with np.errstate(invalid='ignore'):
sampler.run_mcmc(pos, steps)