]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
fix(qav3): filter invalid best trials at MO optimization
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 25 May 2025 13:03:39 +0000 (15:03 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 25 May 2025 13:03:39 +0000 (15:03 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/QuickAdapterV3.py

index 233d90d9974a819e2ebf893e03d98e9b0f94bb2c..b166248d369b31439508867587d79842f98e378e 100644 (file)
@@ -45,7 +45,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
     https://github.com/sponsors/robcaulk
     """
 
-    version = "3.7.65"
+    version = "3.7.66"
 
     @cached_property
     def _optuna_config(self) -> dict:
@@ -90,7 +90,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
         )
         self._optuna_hp_value: dict[str, float] = {}
         self._optuna_train_value: dict[str, float] = {}
-        self._optuna_label_values: dict[str, dict] = {}
+        self._optuna_label_values: dict[str, list] = {}
         self._optuna_hp_params: dict[str, dict] = {}
         self._optuna_train_params: dict[str, dict] = {}
         self._optuna_label_params: dict[str, dict] = {}
@@ -409,11 +409,14 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
                 f"Expected 2 objectives for {namespace} namespace, but got {n_objectives}"
             )
 
-        best_trials = [
-            trial
-            for trial in study.best_trials
-            if trial.values is not None and len(trial.values) == n_objectives
-        ]
+        best_trials = []
+        for trial in study.best_trials:
+            if trial.values is not None and len(trial.values) == n_objectives:
+                if all(
+                    isinstance(values, (int, float)) and np.isfinite(values)
+                    for values in trial.values
+                ):
+                    best_trials.append(trial)
         if not best_trials:
             return None
 
index 0ad3a8cbd2d4fad1534b1cd7d20a457236d92567..280bbcee6b5460e475cd0de7668acd1eddcb60d2 100644 (file)
@@ -60,7 +60,7 @@ class QuickAdapterV3(IStrategy):
     INTERFACE_VERSION = 3
 
     def version(self) -> str:
-        return "3.3.67"
+        return "3.3.68"
 
     timeframe = "5m"