Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iburn estimate can fail #15

Closed
dflemin3 opened this issue Apr 28, 2018 · 2 comments
Closed

iburn estimate can fail #15

dflemin3 opened this issue Apr 28, 2018 · 2 comments
Assignees
Labels

Comments

@dflemin3
Copy link
Owner

traceback:

[ 0.04016588 0.04634279 0.0908399 0.12369704]
Calling MIERUN for run: /Users/Jake/Documents/smart_runs/titan/runmie_titan_test3_zq2rn.scr
SUCCESS: MIERUN run complete: /Users/Jake/Documents/smart_runs/titan/runmie_titan_test3_zq2rn.scr
Calling SMART for run: /Users/Jake/Documents/smart_runs/titan/ap_tmp/runsmart_titan_test3_zq2rn_hitran2012_1666_16666cm.scr
SUCCESS: SMART run complete: /Users/Jake/Documents/smart_runs/titan/ap_tmp/runsmart_titan_test3_zq2rn_hitran2012_1666_16666cm.scr
-12597246.1497
/Users/Jake/Projects/Packages/approxposterior/approxposterior/mcmc_utils.py:39: RuntimeWarning: invalid value encountered in true_divide
result = r/(variance*(np.arange(n, 0, -1)))

ValueError Traceback (most recent call last)
in ()
6 bounds=bounds, which_kernel=which_kernel,
7 n_kl_samples=100000, verbose=False, debug=False,
----> 8 timing=False)
/Users/Jake/Projects/Packages/approxposterior/approxposterior/bp.py in run(self, theta, y, m0, m, M, nmax, Dmax, kmax, sampler, cv, seed, timing, which_kernel, bounds, debug, n_kl_samples, verbose, update_prior, **kw)
285
286 # Estimate burn-in, save it
--> 287 iburn = mcmc_utils.estimate_burnin(sampler, nwalk, nsteps, ndim)
288 self.iburns.append(iburn)
289
/Users/Jake/Projects/Packages/approxposterior/approxposterior/mcmc_utils.pyc in estimate_burnin(sampler, nwalk, nsteps, ndim)
111
112 # Save autocorrelation length
--> 113 autolength.append(np.min(roots))
114
115 # List of chains that we are keeping
/Users/Jake/anaconda2/lib/python2.7/site-packages/numpy/core/fromnumeric.pyc in amin(a, axis, out, keepdims)
2370
2371 return _methods._amin(a, axis=axis,
-> 2372 out=out, **kwargs)
2373
2374
/Users/Jake/anaconda2/lib/python2.7/site-packages/numpy/core/_methods.pyc in _amin(a, axis, out, keepdims)
27
28 def _amin(a, axis=None, out=None, keepdims=False):
---> 29 return umr_minimum(a, axis, None, out, keepdims)
30
31 def _sum(a, axis=None, dtype=None, out=None, keepdims=False):
ValueError: zero-size array to reduction operation minimum which has no identity

potential fix: try/except ValueError loop where iburn set to 1. Add assert statement to ensure sampler has non-zero length, i.e. to ensure than that the MCMC actually ran

@dflemin3 dflemin3 added the bug label Apr 28, 2018
@dflemin3 dflemin3 self-assigned this Apr 28, 2018
@dflemin3
Copy link
Owner Author

Current fix: if no roots are found, set iburn to 0

try:
    min_root = np.min(roots)
except ValueError:
    min_root = 0
    warn_msg = "WARNING: Burn-in estimation failed.  iburn set to 0."
    warnings.warn(warn_msg)

autolength.append(min_root)

@dflemin3
Copy link
Owner Author

This issue is specific to our current burn-in estimation function, so it's fixed. In #16 I demonstrate that we need to reconfigure how burn-in estimation is done, so future burn-in calculation discussion should go there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant