Skip to content

Commit

Permalink
fix too large samplesize for bootstrap when run numbers are divers
Browse files Browse the repository at this point in the history
  • Loading branch information
nikohansen committed Mar 31, 2022
1 parent d71436c commit 3b81d0b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
17 changes: 13 additions & 4 deletions code-postprocessing/cocopp/compall/pprldmany.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,11 +662,20 @@ def main(dictAlg, order=None, outputdir='.', info='default',
run_numbers = []
for dsl in dictDim.values():
run_numbers.extend([ds.nbRuns() for ds in dsl])
try: lcm = np.lcm.reduce(run_numbers) # lowest common multiplier
except: lcm = max(run_numbers) # fallback for old numpy versions
samplesize = lcm
if genericsettings.in_a_hurry >= 100:
samplesize = max(run_numbers)
else:
try: lcm = np.lcm.reduce(run_numbers) # lowest common multiplier
except: lcm = max(run_numbers) # fallback for old numpy versions
# slight abuse of bootstrap_sample_size to avoid a huge number
samplesize = min((genericsettings.simulated_runlength_bootstrap_sample_size, lcm))
if testbedsettings.current_testbed.instances_are_uniform:
samplesize = max(perfprofsamplesize, lcm) # maybe more bootstrapping with unsuccessful trials
samplesize = max((genericsettings.simulated_runlength_bootstrap_sample_size,
samplesize)) # maybe more bootstrapping with unsuccessful trials
if samplesize > 1e4:
warntxt = ("Sample size equals {} which may take very long. "
"This is likely to be unintended, hence a bug.".format(samplesize))
warnings.warn(warntxt)
for f, dictAlgperFunc in sorted(dictFunc.items()):
# print(target_values((f, dim)))
for j, t in enumerate(target_values((f, dim))):
Expand Down
7 changes: 5 additions & 2 deletions code-postprocessing/cocopp/genericsettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@
dim_related_markers = ('+', 'v', '*', 'o', 's', 'D', 'x')
dim_related_colors = ('c', 'g', 'b', 'k', 'r', 'm', 'k', 'y', 'k', 'c', 'r', 'm')

simulated_runlength_bootstrap_sample_size = 10 + 990 // (1 + 10 * max((0, in_a_hurry))) # for tables and plots
"""10000 would be better for a final camera-ready paper version"""
simulated_runlength_bootstrap_sample_size = 30 + int(970 / (1 + 10 * max((0, in_a_hurry))))
"""bootstrap samples, 30 is a multiple of 10 and 15.
Used for tables and plots. 1e4 would be preferable
for a final camera-ready paper version.
"""


# single_target_pprldistr_values = (10., 1e-1, 1e-4, 1e-8) # used as default in pprldistr.plot method, on graph for each
Expand Down

0 comments on commit 3b81d0b

Please sign in to comment.