]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
refactor(qav3): ensure optuna storage backend is stored in the model
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 10 Feb 2025 14:11:54 +0000 (15:11 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 10 Feb 2025 14:11:54 +0000 (15:11 +0100)
path

Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/config-template.json
quickadapter/user_data/freqaimodels/LightGBMRegressorQuickAdapterV35.py
quickadapter/user_data/freqaimodels/XGBoostRegressorQuickAdapterV35.py

index c72b9eba2a29401ee461a22948b97759d7a3968a..12e5a6efcba547efbb362f7a625b1ae0e1ba1726 100644 (file)
     "purge_old_models": 2,
     "expiration_hours": 12,
     "train_period_days": 60,
-    "live_retrain_hours": 0.5,
+    // "live_retrain_hours": 1,
     "backtest_period_days": 2,
     "write_metrics_to_disk": false,
     "identifier": "quickadapter-xgboost",
index de96ea11046b01169ab7d6073fcf95bc63d26877..f8429a6f2821c2ebb5934a50d4c1e0190aed3403 100644 (file)
@@ -69,6 +69,7 @@ class LightGBMRegressorQuickAdapterV35(BaseRegressionModel):
         start = time.time()
         if self.__optuna_hyperopt:
             study_name = str(dk.pair)
+            storage_dir = str(dk.full_path)
             pruner = optuna.pruners.HyperbandPruner()
             study = optuna.create_study(
                 study_name=study_name,
@@ -80,7 +81,7 @@ class LightGBMRegressorQuickAdapterV35(BaseRegressionModel):
                 direction=optuna.study.StudyDirection.MINIMIZE,
                 storage=optuna.storages.JournalStorage(
                     optuna.storages.journal.JournalFileBackend(
-                        f"./optuna-lgbm-{sanitize_path(study_name)}.log"
+                        f"{storage_dir}/optuna-{sanitize_path(study_name)}.log"
                     )
                 ),
                 load_if_exists=True,
index 63fd197f4b2013f0c8f3202dec7788729c0713d2..c6c8a0cf6f0623f88084ed4942ffea58bd1b11c1 100644 (file)
@@ -69,6 +69,7 @@ class XGBoostRegressorQuickAdapterV35(BaseRegressionModel):
         start = time.time()
         if self.__optuna_hyperopt:
             study_name = str(dk.pair)
+            storage_dir = str(dk.full_path)
             pruner = optuna.pruners.HyperbandPruner()
             study = optuna.create_study(
                 study_name=study_name,
@@ -79,7 +80,7 @@ class XGBoostRegressorQuickAdapterV35(BaseRegressionModel):
                 pruner=pruner,
                 direction=optuna.study.StudyDirection.MINIMIZE,
                 storage=optuna.storages.journal.JournalFileBackend(
-                    f"./optuna-xgboost-{sanitize_path(study_name)}.log"
+                    f"{storage_dir}/optuna-{sanitize_path(study_name)}.log"
                 ),
                 load_if_exists=True,
             )