From ec346cfad385e0a6baaec94c591d0b1dbb0ce347 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 8 Jan 2026 22:28:41 +0100 Subject: [PATCH] fix(quickadapter): use trial pruning for CatBoost grow_policy validation Replace dynamic grow_policy options with trial pruning to avoid Optuna's "CategoricalDistribution does not support dynamic value space" error. Always suggest all grow_policy options, but prune trials with incompatible Ordered boosting + nonsymmetric trees combinations. --- quickadapter/user_data/strategies/Utils.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/quickadapter/user_data/strategies/Utils.py b/quickadapter/user_data/strategies/Utils.py index 8cde3cc..a2d4354 100644 --- a/quickadapter/user_data/strategies/Utils.py +++ b/quickadapter/user_data/strategies/Utils.py @@ -2489,10 +2489,13 @@ def get_optuna_study_model_parameters( "boosting_type", boosting_type_options ) bootstrap_type = trial.suggest_categorical("bootstrap_type", bootstrap_options) - if boosting_type == "Ordered": - grow_policy_options = ["SymmetricTree"] - else: - grow_policy_options = ["SymmetricTree", "Depthwise", "Lossguide"] + grow_policy = trial.suggest_categorical( + "grow_policy", ["SymmetricTree", "Depthwise", "Lossguide"] + ) + if boosting_type == "Ordered" and grow_policy != "SymmetricTree": + raise optuna.TrialPruned( + "Ordered boosting is not supported for nonsymmetric trees" + ) params: dict[str, Any] = { # Boosting/Training @@ -2513,9 +2516,7 @@ def get_optuna_study_model_parameters( "min_data_in_leaf": _optuna_suggest_int_from_range( trial, "min_data_in_leaf", ranges["min_data_in_leaf"], min_val=1 ), - "grow_policy": trial.suggest_categorical( - "grow_policy", grow_policy_options - ), + "grow_policy": grow_policy, # Regularization "l2_leaf_reg": trial.suggest_float( "l2_leaf_reg", -- 2.53.0