Skip to content

Commit

Permalink
Remove experimental argument
Browse files Browse the repository at this point in the history
  • Loading branch information
timmens committed Jan 19, 2024
1 parent fb4653b commit ae05163
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
4 changes: 4 additions & 0 deletions src/tranquilo/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def get_default_batch_size(n_cores):
return n_cores


def get_default_filter_target_sample_size():
return 3


def get_default_acceptance_decider(noisy):
return "noisy" if noisy else "classic"

Expand Down
13 changes: 8 additions & 5 deletions src/tranquilo/process_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
get_default_sample_size,
get_default_search_radius_factor,
get_default_stagnation_options,
get_default_filter_target_sample_size,
update_option_bundle,
NoiseAdaptationOptions,
)
Expand Down Expand Up @@ -87,9 +88,6 @@ def process_arguments(
variance_estimator_options=None,
infinity_handler="relative",
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 @@ -167,6 +165,7 @@ def process_arguments(
model_type=model_type,
x=x,
)
filter_target_sample_size = _process_filter_target_sample_size(target_sample_size)
model_fitter = _process_model_fitter(
model_fitter, model_type=model_type, sample_size=target_sample_size, x=x
)
Expand Down Expand Up @@ -234,6 +233,7 @@ def process_arguments(
"radius_options": radius_options,
"batch_size": batch_size,
"target_sample_size": target_sample_size,
"filter_target_sample_size": filter_target_sample_size,
"stagnation_options": stagnation_options,
"noise_adaptation_options": noise_adaptation_options,
"search_radius_factor": search_radius_factor,
Expand All @@ -250,8 +250,6 @@ 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 Expand Up @@ -369,3 +367,8 @@ def _process_n_evals_per_point(n_evals, noisy, noise_adaptation_options):
raise ValueError("n_evals_per_point must be non-negative.")

return out


def _process_filter_target_sample_size(target_sample_size):
factor = get_default_filter_target_sample_size()
return int(np.floor(target_sample_size * factor))
13 changes: 2 additions & 11 deletions src/tranquilo/tranquilo.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def _internal_tranquilo(
noise_adaptation_options,
batch_size,
target_sample_size,
filter_target_sample_size,
stagnation_options,
search_radius_factor,
n_evals_per_point,
Expand All @@ -49,9 +50,6 @@ 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 @@ -108,18 +106,11 @@ 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=int(
np.floor(_filter_target_sample_size_factor * target_sample_size)
),
target_size=filter_target_sample_size,
history=history,
n_evals_per_point=n_evals_per_point,
)
Expand Down

0 comments on commit ae05163

Please sign in to comment.