Skip to content

Commit

Permalink
Experiment (2): Drop worst points if no. of points larger than factor…
Browse files Browse the repository at this point in the history
… times targeted sample size
  • Loading branch information
timmens committed Jan 17, 2024
1 parent 9488279 commit fb4653b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/tranquilo/process_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def process_arguments(
residualize=None,
# Experimental options
experimental=None,
filter_target_sample_size_factor=None,
):
# warning for things that do not work well yet
if noisy and functype == "scalar":
Expand Down Expand Up @@ -249,6 +250,8 @@ def process_arguments(
"aggregate_model": aggregate_model,
"estimate_variance": estimate_variance,
"accept_candidate": accept_candidate,
"filter_target_sample_size_factor": filter_target_sample_size_factor,
"experimental": experimental,
}

return out
Expand Down
12 changes: 11 additions & 1 deletion src/tranquilo/tranquilo.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def _internal_tranquilo(
aggregate_model,
estimate_variance,
accept_candidate,
# experimental options
experimental,
filter_target_sample_size_factor,
):
if n_evals_at_start > 1:
eval_info = {0: next_multiple(n_evals_at_start, base=batch_size)}
Expand Down Expand Up @@ -105,11 +108,18 @@ def _internal_tranquilo(

old_xs = history.get_xs(old_indices)

if experimental:
_filter_target_sample_size_factor = filter_target_sample_size_factor
else:
_filter_target_sample_size_factor = 1

model_xs, model_indices = filter_points(
xs=old_xs,
indices=old_indices,
state=state,
target_size=target_sample_size,
target_size=int(
np.floor(_filter_target_sample_size_factor * target_sample_size)
),
history=history,
n_evals_per_point=n_evals_per_point,
)
Expand Down

0 comments on commit fb4653b

Please sign in to comment.