]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
fix(qav3): refine optuna loaded study validation test
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 15 Feb 2025 21:01:40 +0000 (22:01 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 15 Feb 2025 21:01:40 +0000 (22:01 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/freqaimodels/LightGBMRegressorQuickAdapterV35.py
quickadapter/user_data/freqaimodels/XGBoostRegressorQuickAdapterV35.py

index 8820b80fb284a90abf35ba47e06eebf945e30e89..04152a8caf6eb6fea92df037346f56dec849e616 100644 (file)
@@ -394,14 +394,8 @@ class LightGBMRegressorQuickAdapterV35(BaseRegressionModel):
         if not study:
             return False
         try:
-            # Check if there are completed trials
-            if len(study.trials) == 0:
-                return False
-
-            # Check if best_params exists (raises ValueError if no trials succeeded)
-            _ = study.best_params
-            return True
-        except ValueError:
+            _ = study.trials
+        except KeyError:
             return False
 
 
index fa3fedfede36642d1f990be516e5fffc95639c76..0872136c9cdb2f21bf930decdfa2efae9778c377 100644 (file)
@@ -395,14 +395,8 @@ class XGBoostRegressorQuickAdapterV35(BaseRegressionModel):
         if not study:
             return False
         try:
-            # Check if there are completed trials
-            if len(study.trials) == 0:
-                return False
-
-            # Check if best_params exists (raises ValueError if no trials succeeded)
-            _ = study.best_params
-            return True
-        except ValueError:
+            _ = study.trials
+        except KeyError:
             return False