Skip to content

Commit c30edf9

Browse files
committed
get rid of n_effective for static run
1 parent 7b557df commit c30edf9

1 file changed

Lines changed: 1 addition & 36 deletions

File tree

py/dynesty/sampler.py

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,7 @@ class Sampler:
270270
271271
live_points : list of 3 or 4 `~numpy.ndarray`
272272
Each with shape (nlive, ndim) for the first three arrays.
273-
If `blob=True`, a fourth array of blobs (arbitrary shape) may be
274-
included.
273+
If `blob=True`, a fourth array of blobs (arbitrary shape) may be included.
275274
276275
sampling : {`'unif'`, `'rwalk'`, `'slice'`, `'rslice'`}
277276
Sampling Method used to sample uniformly within the likelihood
@@ -909,7 +908,6 @@ def sample(self,
909908
maxcall=None,
910909
dlogz=0.01,
911910
logl_max=np.inf,
912-
n_effective=np.inf,
913911
add_live=True,
914912
save_bounds=True,
915913
resume=False):
@@ -943,11 +941,6 @@ def sample(self,
943941
Iteration will stop when the sampled ln(likelihood) exceeds the
944942
threshold set by `logl_max`. Default is no bound (`np.inf`).
945943
946-
n_effective: int, optional
947-
Minimum number of effective posterior samples. If the estimated
948-
"effective sample size" (ESS) exceeds this number,
949-
sampling will terminate. Default is no ESS (`np.inf`).
950-
951944
add_live : bool, optional
952945
Whether or not to add the remaining set of live points to
953946
the list of samples when calculating `n_effective`.
@@ -1074,24 +1067,6 @@ def sample(self,
10741067
if loglstar > logl_max:
10751068
stop_iterations = True
10761069

1077-
# Stopping criterion 5: the number of effective posterior
1078-
# samples has been achieved.
1079-
if (n_effective is not None) and not np.isposinf(n_effective):
1080-
current_n_effective = self.n_effective
1081-
# TODO This needs to be refactored
1082-
# here we are adding final live points then checking
1083-
# if n_effective is large enough then removing them again
1084-
# this is slow and not a good logic
1085-
if current_n_effective > n_effective:
1086-
if add_live:
1087-
self.add_final_live(print_progress=False)
1088-
1089-
# Recompute n_effective after adding live points
1090-
current_n_effective = self.n_effective
1091-
self._remove_live_points()
1092-
self.added_live = False
1093-
if current_n_effective > n_effective:
1094-
stop_iterations = True
10951070
if np.ptp(self.live_logl) == 0:
10961071
warnings.warn(
10971072
'We have reached the plateau in the likelihood we are'
@@ -1213,7 +1188,6 @@ def run_nested(self,
12131188
maxcall=None,
12141189
dlogz=None,
12151190
logl_max=np.inf,
1216-
n_effective=None,
12171191
add_live=True,
12181192
print_progress=True,
12191193
print_func=None,
@@ -1285,14 +1259,6 @@ def run_nested(self,
12851259
saved in the end of the run irrespective of checkpoint_every.
12861260
"""
12871261

1288-
# Check for deprecated options
1289-
if n_effective is not None:
1290-
with warnings.catch_warnings():
1291-
warnings.filterwarnings("once")
1292-
warnings.warn(
1293-
"The n_effective option to Sampler.run_nested is "
1294-
"deprecated and will be removed in future releases",
1295-
DeprecationWarning)
12961262

12971263
# Define our stopping criteria.
12981264
if dlogz is None:
@@ -1319,7 +1285,6 @@ def run_nested(self,
13191285
dlogz=dlogz,
13201286
logl_max=logl_max,
13211287
save_bounds=save_bounds,
1322-
n_effective=n_effective,
13231288
resume=resume,
13241289
add_live=add_live)):
13251290
ncall += results.nc

0 commit comments

Comments
 (0)