anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: joshspeagle/dynesty
Issue: Probabilities do not sum to 1

While running recent version of the code, I've hit this error. 

```
  File "/home/skoposov/pyenv38/lib/python3.8/site-packages/dynesty/dynamicsampler.py", line 1596, in run_nested
    passback = self.add_batch(nlive=nlive_batch,
  File "/home/skoposov/pyenv38/lib/python3.8/site-packages/dynesty/dynamicsampler.py", line 1716, in add_batch
    for results in self.sample_batch(nlive_new=nlive,
  File "/home/skoposov/pyenv38/lib/python3.8/site-packages/dynesty/dynamicsampler.py", line 1054, in sample_batch
    subset = self.rstate.choice(np.nonzero(subset)[0],
  File "mtrand.pyx", line 933, in numpy.random.mtrand.RandomState.choice
ValueError: probabilities do not sum to 1
```
which was recently introduced code

I haven't had a chance to investigate this.  I'm guessing it has to do with very large/small/inf values in logwt




Changed files:
py/dynesty/dynamicsampler.py

diff --git a/py/dynesty/dynamicsampler.py b/py/dynesty/dynamicsampler.py
index 8ee5315..216adee 100644
--- a/py/dynesty/dynamicsampler.py
+++ b/py/dynesty/dynamicsampler.py
@@ -1043,7 +1043,11 @@ class DynamicSampler(object):
             # we are weighting each point by 1/L_i * 1/W_i to ensure
             # uniform sampling within boundary volume
             cur_logwt = -saved_logl[subset] - saved_logwt[subset]
-            cur_wt = np.exp(cur_logwt - logsumexp(cur_logwt))
+            cur_wt = np.exp(cur_logwt - cur_logwt.max())
+            cur_wt = cur_wt / cur_wt.sum()
+            # i normalize in linear space rather then using logsumexp
+            # because cur_wt.sum() needs to be 1 for random.choice
+
             # we are now randomly sampling with weights
             # notice that since we are samplign without
             # replacement we aren't guaranteed to be able
Repository: joshspeagle/dynesty
Issue: add_batch volume of the single point

It looks like the recent change with self.sampler.update(0)
leads to issues: see below

```
 File "/home/skoposov/pyenv38/lib/python3.8/site-packages/dynesty/dynamicsampler.py", line 1595, in run_nested
    passback = self.add_batch(nlive=nlive_batch,
  File "/home/skoposov/pyenv38/lib/python3.8/site-packages/dynesty/dynamicsampler.py", line 1715, in add_batch
    for results in self.sample_batch(nlive_new=nlive,
  File "/home/skoposov/pyenv38/lib/python3.8/site-packages/dynesty/dynamicsampler.py", line 1079, in sample_batch
    bound = self.sampler.update(0)
  File "/home/skoposov/pyenv38/lib/python3.8/site-packages/dynesty/nestedsamplers.py", line 689, in update
    self.mell.update(self.live_u[:, :self.ncdim],
  File "/home/skoposov/pyenv38/lib/python3.8/site-packages/dynesty/bounding.py", line 618, in update
    firstell = bounding_ellipsoid(points, pointvol=pointvol)
  File "/home/skoposov/pyenv38/lib/python3.8/site-packages/dynesty/bounding.py", line 1410, in bounding_ellipsoid
    raise ValueError("Cannot compute a bounding ellipsoid to a "
ValueError: Cannot compute a bounding ellipsoid to a single point if `pointvol` is not specified.
```
The investigation shows that this happens when the  subset https://github.com/joshspeagle/dynesty/blob/b3dbd52369a9b9172b20e76cb53ddd7f43bf9a1c/py/dynesty/dynamicsampler.py#L1035
has only one element and therefore the ellipsoid has only one point. 
It is still not clear to me what value is the most appropriate there. So for my own purposese I've temporarily set the volume to
math.exp(-1. * len(saved_logl) / nblive)


Changed files:
py/dynesty/dynamicsampler.py

diff --git a/py/dynesty/dynamicsampler.py b/py/dynesty/dynamicsampler.py
index 216adee..ae3eb45 100644
--- a/py/dynesty/dynamicsampler.py
+++ b/py/dynesty/dynamicsampler.py
@@ -1077,10 +1077,11 @@ class DynamicSampler(object):
 
             live_logl_min = min(live_logl)
             if self.sampler._beyond_unit_bound(live_logl_min):
-                # notice we are setting the volume to zero
+                # notice we are setting the volume to some value
                 # as it is really not clear what the volume should
-                # be
-                bound = self.sampler.update(0)
+                # be TODO
+                pointvol = math.exp(-1. * len(saved_logl) / nblive)
+                bound = self.sampler.update(pointvol)
                 if save_bounds:
                     self.sampler.bound.append(copy.deepcopy(bound))
                 self.sampler.nbound += 1