diff --git a/src/neps/api.py b/src/neps/api.py index cd2b26a7..c85b0225 100644 --- a/src/neps/api.py +++ b/src/neps/api.py @@ -238,7 +238,7 @@ def run( # Used to create the yaml holding information about the searcher. # Also important for testing and debugging the api. searcher_info = { - "searcher_name": searcher, + "searcher_name": str(searcher), "searcher_alg": searcher_alg, "user_defined_searcher": user_defined_searcher, "searcher_args_user_modified": False, diff --git a/src/neps/optimizers/bayesian_optimization/acquisition_samplers/freeze_thaw_sampler.py b/src/neps/optimizers/bayesian_optimization/acquisition_samplers/freeze_thaw_sampler.py index dfe7a60b..c103c993 100644 --- a/src/neps/optimizers/bayesian_optimization/acquisition_samplers/freeze_thaw_sampler.py +++ b/src/neps/optimizers/bayesian_optimization/acquisition_samplers/freeze_thaw_sampler.py @@ -21,7 +21,14 @@ def __init__(self, **kwargs): self.b_step = None self.n = None self.pipeline_space = None + # args to manage tabular spaces/grid self.is_tabular = False + self.sample_full_table = None + self.set_sample_full_tabular(True) # sets flag that samples full table + + def set_sample_full_tabular(self, flag: bool=False): + if self.is_tabular: + self.sample_full_table = flag def _sample_new( self, index_from: int, n: int = None, ignore_fidelity: bool = False @@ -119,8 +126,11 @@ def __sample_single_new_tabular(index: int): _n = n if n is not None else self.SAMPLES_TO_DRAW _partial_ids = {conf["id"].value for conf in partial_configs} _all_ids = set(self.pipeline_space.custom_grid_table.index.values) - # accounting for unseen configs only - _n = min(_n, len(_all_ids - _partial_ids)) + + # accounting for unseen configs only, samples remaining table if flag is set + max_n = len(_all_ids) + 1 if self.sample_full_table else _n + _n = min(max_n, len(_all_ids - _partial_ids)) + _new_configs = np.random.choice( list(_all_ids - _partial_ids), size=_n, replace=False )