From a281b4d7fd30798682f266481e5b628144cd7c6d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 14 Feb 2025 21:11:31 +0100 Subject: [PATCH] fix(qav3): ensure previous optuna params are reused in case of failure MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../freqaimodels/LightGBMRegressorQuickAdapterV35.py | 4 ++-- .../user_data/freqaimodels/XGBoostRegressorQuickAdapterV35.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/quickadapter/user_data/freqaimodels/LightGBMRegressorQuickAdapterV35.py b/quickadapter/user_data/freqaimodels/LightGBMRegressorQuickAdapterV35.py index f4b0d46..c14e396 100644 --- a/quickadapter/user_data/freqaimodels/LightGBMRegressorQuickAdapterV35.py +++ b/quickadapter/user_data/freqaimodels/LightGBMRegressorQuickAdapterV35.py @@ -81,7 +81,7 @@ class LightGBMRegressorQuickAdapterV35(BaseRegressionModel): if dk.pair not in self.__optuna_hp: self.__optuna_hp[dk.pair] = {} self.__optuna_hp[dk.pair] = params - + if self.__optuna_hp.get(dk.pair): train_window = self.__optuna_hp[dk.pair].get("train_period_candles") X = X.tail(train_window) y = y.tail(train_window) @@ -287,7 +287,7 @@ class LightGBMRegressorQuickAdapterV35(BaseRegressionModel): ) except Exception as e: logger.error( - f"Optuna hyperopt failed: {e}. Please consider using a concurrency friendly storage backend like 'file' or lower the number of jobs." + f"Optuna hyperopt failed: {e}. Consider using a concurrency friendly storage backend like 'file' or lower the number of jobs." ) hyperopt_failed = True diff --git a/quickadapter/user_data/freqaimodels/XGBoostRegressorQuickAdapterV35.py b/quickadapter/user_data/freqaimodels/XGBoostRegressorQuickAdapterV35.py index ce0b8a9..3c6cb57 100644 --- a/quickadapter/user_data/freqaimodels/XGBoostRegressorQuickAdapterV35.py +++ b/quickadapter/user_data/freqaimodels/XGBoostRegressorQuickAdapterV35.py @@ -85,7 +85,7 @@ class XGBoostRegressorQuickAdapterV35(BaseRegressionModel): if dk.pair not in self.__optuna_hp: self.__optuna_hp[dk.pair] = {} self.__optuna_hp[dk.pair] = params - + if self.__optuna_hp.get(dk.pair): train_window = self.__optuna_hp[dk.pair].get("train_period_candles") X = X.tail(train_window) y = y.tail(train_window) @@ -290,7 +290,7 @@ class XGBoostRegressorQuickAdapterV35(BaseRegressionModel): ) except Exception as e: logger.error( - f"Optuna hyperopt failed: {e}. Please consider using a concurrency friendly storage backend like 'file' or lower the number of jobs." + f"Optuna hyperopt failed: {e}. Consider using a concurrency friendly storage backend like 'file' or lower the number of jobs." ) hyperopt_failed = True -- 2.43.0