Closed JohannesBuchner closed 4 years ago
What seems to be happening is the bounding ellipsoid becomes ill-defined. Here's what I get grabbing the final bound right before it crashes the same way:
bound = sampler.bound[-1] # grab multi-ellipsoid
bound.ctrs, bound.covs # get covariance
Out:
array([[5.68727758e-01, 6.20765700e-10]]),
array([[[ 3.40732147e-01, -4.60818321e-10],
[-4.60818321e-10, 2.58193405e-18]]])
Right before this happens, it has a bunch of ellipsoids to try and capture this structure:
sampler.bound[-2].ctrs, sampler.bound[-2].covs
Out:
array([[7.78994760e-01, 7.76837638e-10],
[6.04067203e-01, 8.66522033e-10],
[5.38103294e-01, 1.24924083e-09],
[4.50995375e-01, 1.17161581e-09],
[3.26508871e-01, 1.39851199e-09],
[2.09271961e-01, 1.50004789e-09],
[1.19143973e-01, 2.09419876e-09],
[5.31522393e-02, 3.27813293e-09],
[2.15845285e-02, 3.57887206e-09],
[9.31883901e-03, 4.08545452e-09],
[1.90845769e-03, 6.43768057e-09]]),
array([[[ 4.06616474e-02, -5.18704975e-11],
[-5.18704975e-11, 1.04618778e-18]],
[[ 1.71662201e-03, 5.10527174e-12],
[ 5.10527174e-12, 1.91615551e-18]],
[[ 9.08793200e-04, -1.22183574e-11],
[-1.22183574e-11, 9.21219120e-19]],
[[ 5.25601725e-03, 1.49128177e-11],
[ 1.49128177e-11, 3.37010043e-18]],
[[ 6.51900859e-03, -1.62753168e-11],
[-1.62753168e-11, 3.46138065e-18]],
[[ 4.30822456e-03, 2.91625038e-12],
[ 2.91625038e-12, 4.61720812e-18]],
[[ 4.95258689e-03, 2.00712150e-11],
[ 2.00712150e-11, 7.56857005e-18]],
[[ 6.83041254e-04, -3.15470053e-12],
[-3.15470053e-12, 9.91778647e-18]],
[[ 1.60135247e-04, -1.89601649e-11],
[-1.89601649e-11, 2.85046645e-17]],
[[ 2.51907790e-05, -1.16499007e-11],
[-1.16499007e-11, 3.68064311e-17]],
[[ 1.11738885e-05, -2.11335828e-11],
[-2.11335828e-11, 1.65686054e-16]]])
So it looks like it's a failure in the way the bounds are being dealt with as the axes become very skewed. I experimented with adding in reflective
or periodic
boundary conditions, but it still fails. So looks like issues with the clustering/bounding strike again! (sigh...)
https://johannesbuchner.github.io/UltraNest/ integrates this without problems. One trick I use there is to only accept an update when the new bounding geometry is smaller in volume and did not produce numerical errors. Perhaps such a check would work here too, if numerical issues are the cause.
Yea, that's not too surprising -- the bounding distributions are definitely the least stable part of dynesty
and have issues that have plagued the code for years. I have a bunch of checks I tried to throw in to make the bounds more robust but they don't really seem to have fixed these numerical issues. I probably should add some additional logic similar to yours to finally try and quash these. I'll mark it as a to-do item.
Closing this since it should now be resolved per #195. Thanks @JohannesBuchner!!!
Hi,
I set up the following toy test problem for a systematic evaluation of sampling methods across many types of problems I am making. The likelihood is a product of beta functions with random parameters. I am having issues with dynesty though, even when ndim=2. Is the issue that the ellipsoid wanders outside the cube? It stalls completely.
Here is the full output:
I pressed Ctrl-C after a while, the stack trace perhaps is telling where it is spending its time.
I also got a linalg error with ndim=10: