From 948ec099e697b78952f56efa16400528621e2e45 Mon Sep 17 00:00:00 2001 From: igeni Date: Sat, 23 Mar 2024 13:15:29 +0300 Subject: [PATCH] changed concatenation of strings to f-strings to avoid potential type's mismatch and simplify the code --- vizier/_src/benchmarks/experimenters/hpob/handler.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vizier/_src/benchmarks/experimenters/hpob/handler.py b/vizier/_src/benchmarks/experimenters/hpob/handler.py index e92ae5bca..04e229870 100644 --- a/vizier/_src/benchmarks/experimenters/hpob/handler.py +++ b/vizier/_src/benchmarks/experimenters/hpob/handler.py @@ -129,7 +129,7 @@ def _cached_load_data(cls, @classmethod @functools.lru_cache(maxsize=128) def _cached_surrogates_stats(cls, surrogates_dir: str): - surrogates_file = surrogates_dir + "summary-stats.json" + surrogates_file = f"{surrogates_dir}summary-stats.json" if (Exists(surrogates_file) and not IsDir(surrogates_file)): with Open(surrogates_file, "rt") as f: surrogates_stats = json.load(f) @@ -262,9 +262,9 @@ def evaluate_continuous(self, assert seed != None, ("Provide a valid initialization. Valid options are: " "test0, test1, test2, test3, test4.") - surrogate_name = "surrogate-" + search_space_id + "-" + dataset_id + surrogate_name = f"surrogate-{search_space_id}-{dataset_id}" bst_surrogate = xgb.Booster() - bst_surrogate.load_model(self.surrogates_dir + surrogate_name + ".json") + bst_surrogate.load_model(f"{self.surrogates_dir}{surrogate_name}.json") n_initial_evaluations = 5 X = np.array(self.meta_test_data[search_space_id][dataset_id]["X"])