]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
perf(quickadapter): refine optuna hyperparameters search space
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 28 Dec 2025 19:42:58 +0000 (20:42 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 28 Dec 2025 19:42:58 +0000 (20:42 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/QuickAdapterV3.py
quickadapter/user_data/strategies/Utils.py

index e81c95586148bcfaae55c646e406ae8b03241cfa..187ecd44464662d2ec9fc0f1c0568199085e0f45 100644 (file)
@@ -72,7 +72,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
     https://github.com/sponsors/robcaulk
     """
 
-    version = "3.8.0"
+    version = "3.8.1"
 
     _TEST_SIZE: Final[float] = 0.1
 
index 2359bf4a6ec05d5c0307152db4086d21cfe1767d..090b5be16928cffe12ca294fc91733507e20baee 100644 (file)
@@ -106,7 +106,7 @@ class QuickAdapterV3(IStrategy):
     _TRADING_MODES: Final[tuple[TradingMode, ...]] = ("spot", "margin", "futures")
 
     def version(self) -> str:
-        return "3.8.0"
+        return "3.8.1"
 
     timeframe = "5m"
 
index 98881add6067635c883c34d9e2807ad9c3763b98..b0a13072c5e23856acbcd715289c8fda6ced50bd 100644 (file)
@@ -2185,6 +2185,8 @@ def get_optuna_study_model_parameters(
             "reg_alpha": (1e-8, 10.0),
             "reg_lambda": (1e-8, 10.0),
             "gamma": (1e-8, 1.0),
+            # Binning
+            "max_bin": (63, 255),
         }
         log_scaled_params = {
             "n_estimators",
@@ -2201,11 +2203,6 @@ def get_optuna_study_model_parameters(
         grow_policy = trial.suggest_categorical(
             "grow_policy", ["depthwise", "lossguide"]
         )
-        tree_method = (
-            "hist"
-            if grow_policy == "lossguide"
-            else trial.suggest_categorical("tree_method", ["hist", "approx"])
-        )
 
         return {
             # Boosting/Training
@@ -2219,7 +2216,6 @@ def get_optuna_study_model_parameters(
                 log=True,
             ),
             # Tree structure
-            "tree_method": tree_method,
             "grow_policy": grow_policy,
             **(
                 {
@@ -2271,6 +2267,10 @@ def get_optuna_study_model_parameters(
             "gamma": trial.suggest_float(
                 "gamma", ranges["gamma"][0], ranges["gamma"][1], log=True
             ),
+            # Binning
+            "max_bin": _optuna_suggest_int_from_range(
+                trial, "max_bin", ranges["max_bin"], min_val=2
+            ),
         }
 
     elif regressor == REGRESSORS[1]:  # "lightgbm"
@@ -2408,6 +2408,17 @@ def get_optuna_study_model_parameters(
                 log=True,
             )
 
+        max_depth = trial.suggest_categorical(
+            "max_depth", [None, 2, 3, 4, 5, 6, 7, 8, 10, 12, 15]
+        )
+
+        max_leaf_nodes_range = ranges["max_leaf_nodes"]
+        if isinstance(max_depth, int) and max_depth > 0:
+            max_leaf_nodes_range = (
+                max_leaf_nodes_range[0],
+                min(max_leaf_nodes_range[1], float(2**max_depth)),
+            )
+
         return {
             # Boosting/Training
             "max_iter": _optuna_suggest_int_from_range(
@@ -2420,11 +2431,9 @@ def get_optuna_study_model_parameters(
                 log=True,
             ),
             # Tree structure
-            "max_depth": trial.suggest_categorical(
-                "max_depth", [None, 2, 3, 4, 5, 6, 7, 8, 10, 12, 15]
-            ),
+            "max_depth": max_depth,
             "max_leaf_nodes": _optuna_suggest_int_from_range(
-                trial, "max_leaf_nodes", ranges["max_leaf_nodes"], min_val=2, log=True
+                trial, "max_leaf_nodes", max_leaf_nodes_range, min_val=2, log=True
             ),
             # Leaf constraints
             "min_samples_leaf": _optuna_suggest_int_from_range(