From: Jérôme Benoit Date: Thu, 8 Jan 2026 21:28:41 +0000 (+0100) Subject: fix(quickadapter): use trial pruning for CatBoost grow_policy validation X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=ec346cfad385e0a6baaec94c591d0b1dbb0ce347;p=freqai-strategies.git 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. --- 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",