From c70cd09fabc277c58bd5bc5d5ac9564f3caf7576 Mon Sep 17 00:00:00 2001 From: Contramundum Date: Tue, 6 Feb 2024 20:09:26 +0900 Subject: [PATCH 1/2] Fix preferential continuous check --- optuna_dashboard/preferential/samplers/gp.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/optuna_dashboard/preferential/samplers/gp.py b/optuna_dashboard/preferential/samplers/gp.py index 24cea9a1..188432b8 100644 --- a/optuna_dashboard/preferential/samplers/gp.py +++ b/optuna_dashboard/preferential/samplers/gp.py @@ -389,7 +389,10 @@ class PreferentialGPSampler(optuna.samplers.BaseSampler): def get_all_possible_params(dist: optuna.distributions.BaseDistribution) -> list[Any]: if isinstance(dist, CategoricalDistribution): return list(dist.choices) - elif isinstance(dist, (IntDistribution, FloatDistribution)): + elif ( + isinstance(dist, (IntDistribution, FloatDistribution)) + and dist.step is not None + ): return list(np.arange(dist.low, dist.high, dist.step)) else: return [] From fe00b0285ef8bc5bd181fd68c2a7013fdb34fae8 Mon Sep 17 00:00:00 2001 From: Contramundum Date: Tue, 6 Feb 2024 21:33:27 +0900 Subject: [PATCH 2/2] Fix overflow --- optuna_dashboard/preferential/samplers/gp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/optuna_dashboard/preferential/samplers/gp.py b/optuna_dashboard/preferential/samplers/gp.py index 188432b8..f56fbdeb 100644 --- a/optuna_dashboard/preferential/samplers/gp.py +++ b/optuna_dashboard/preferential/samplers/gp.py @@ -404,7 +404,7 @@ class PreferentialGPSampler(optuna.samplers.BaseSampler): is_all_discrete = all( len(possible_params) > 0 for possible_params in all_possible_params.values() ) - search_space_size = np.prod( + search_space_size = math.prod( # Don't use np.prod to avoid overflow [len(possible_params) for possible_params in all_possible_params.values()] ) # TODO(contramundum53): Fix this arbitrarily chosen limit.