From: Jérôme Benoit Date: Thu, 6 Feb 2025 02:08:22 +0000 (+0100) Subject: perf(qav3): properly size optuna search space X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=32c028b72993d8d38f001be399ca71dbb70e2760;p=freqai-strategies.git perf(qav3): properly size optuna search space Signed-off-by: Jérôme Benoit --- diff --git a/quickadapter/user_data/config-template.json b/quickadapter/user_data/config-template.json index 9fef594..b28f087 100644 --- a/quickadapter/user_data/config-template.json +++ b/quickadapter/user_data/config-template.json @@ -119,7 +119,7 @@ "optuna_hyperopt_trials": 36, "optuna_hyperopt_timeout": 3600, "optuna_hyperopt_jobs": 6, - "optuna_hyperopt_candles_step": 100, + "optuna_hyperopt_candles_step": 10, "extra_returns_per_train": { "DI_value_param1": 0, "DI_value_param2": 0, diff --git a/quickadapter/user_data/freqaimodels/LightGBMRegressorQuickAdapterV35.py b/quickadapter/user_data/freqaimodels/LightGBMRegressorQuickAdapterV35.py index a8ab0d6..65f6b16 100644 --- a/quickadapter/user_data/freqaimodels/LightGBMRegressorQuickAdapterV35.py +++ b/quickadapter/user_data/freqaimodels/LightGBMRegressorQuickAdapterV35.py @@ -231,15 +231,19 @@ def objective( candles_step, params, ): + if (len(X) != len(y)) or (len(X) != len(train_weights)): + raise ValueError("Training sets must have the same length") + if (len(X_test) != len(y_test)) or (len(X_test) != len(test_weights)): + raise ValueError("Test sets must have the same length") train_window = trial.suggest_int( - "train_period_candles", 1152, 17280, step=candles_step + "train_period_candles", 0, len(X), step=candles_step ) X = X.tail(train_window) y = y.tail(train_window) train_weights = train_weights[-train_window:] test_window = trial.suggest_int( - "test_period_candles", 1152, 17280, step=candles_step + "test_period_candles", 0, len(X_test), step=candles_step ) X_test = X_test.tail(test_window) y_test = y_test.tail(test_window) diff --git a/quickadapter/user_data/freqaimodels/XGBoostRegressorQuickAdapterV35.py b/quickadapter/user_data/freqaimodels/XGBoostRegressorQuickAdapterV35.py index 6017b0a..6a2e820 100644 --- a/quickadapter/user_data/freqaimodels/XGBoostRegressorQuickAdapterV35.py +++ b/quickadapter/user_data/freqaimodels/XGBoostRegressorQuickAdapterV35.py @@ -231,15 +231,19 @@ def objective( candles_step, params, ): + if (len(X) != len(y)) or (len(X) != len(train_weights)): + raise ValueError("Training sets must have the same length") + if (len(X_test) != len(y_test)) or (len(X_test) != len(test_weights)): + raise ValueError("Test sets must have the same length") train_window = trial.suggest_int( - "train_period_candles", 1152, 17280, step=candles_step + "train_period_candles", 0, len(X), step=candles_step ) X = X.tail(train_window) y = y.tail(train_window) train_weights = train_weights[-train_window:] test_window = trial.suggest_int( - "test_period_candles", 1152, 17280, step=candles_step + "test_period_candles", 0, len(X_test), step=candles_step ) X_test = X_test.tail(test_window) y_test = y_test.tail(test_window)