From 3ed4d987f7b13f3a27c6c71f59a11287777b060f Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 26 Feb 2025 20:57:40 +0100 Subject: [PATCH] refactor(qav3)!: sensible name for prediction thresholds smoothing MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- quickadapter/user_data/config-template.json | 2 +- .../freqaimodels/LightGBMRegressorQuickAdapterV35.py | 12 +++++++----- .../freqaimodels/XGBoostRegressorQuickAdapterV35.py | 12 +++++++----- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/quickadapter/user_data/config-template.json b/quickadapter/user_data/config-template.json index e9a5931..ec72793 100644 --- a/quickadapter/user_data/config-template.json +++ b/quickadapter/user_data/config-template.json @@ -114,7 +114,7 @@ "fit_live_predictions_candles": 300, "data_kitchen_thread_count": 6, // set to number of CPU threads / 4 "track_performance": false, - "predictions_smoothing": "mean", + "prediction_thresholds_smoothing": "mean", "outlier_threshold": 0.999, "optuna_hyperopt": { "enabled": true, diff --git a/quickadapter/user_data/freqaimodels/LightGBMRegressorQuickAdapterV35.py b/quickadapter/user_data/freqaimodels/LightGBMRegressorQuickAdapterV35.py index 625ddc3..91015a4 100644 --- a/quickadapter/user_data/freqaimodels/LightGBMRegressorQuickAdapterV35.py +++ b/quickadapter/user_data/freqaimodels/LightGBMRegressorQuickAdapterV35.py @@ -269,22 +269,24 @@ class LightGBMRegressorQuickAdapterV35(BaseRegressionModel): fit_live_predictions_candles: int, label_period_candles: int, ) -> tuple[float, float]: - predictions_smoothing = self.freqai_info.get("predictions_smoothing", "mean") - if predictions_smoothing == "quantile": + prediction_thresholds_smoothing = self.freqai_info.get( + "prediction_thresholds_smoothing", "mean" + ) + if prediction_thresholds_smoothing == "quantile": return self.quantile_min_max_pred( pred_df, fit_live_predictions_candles, label_period_candles ) - elif predictions_smoothing == "mean": + elif prediction_thresholds_smoothing == "mean": return mean_min_max_pred( pred_df, fit_live_predictions_candles, label_period_candles ) - elif predictions_smoothing == "median": + elif prediction_thresholds_smoothing == "median": return median_min_max_pred( pred_df, fit_live_predictions_candles, label_period_candles ) else: raise ValueError( - f"Invalid predictions_smoothing value: '{predictions_smoothing}'" + f"Invalid prediction_thresholds_smoothing value: '{prediction_thresholds_smoothing}'" ) def optuna_hp_enqueue_previous_best_trial( diff --git a/quickadapter/user_data/freqaimodels/XGBoostRegressorQuickAdapterV35.py b/quickadapter/user_data/freqaimodels/XGBoostRegressorQuickAdapterV35.py index 58dd417..5e798fd 100644 --- a/quickadapter/user_data/freqaimodels/XGBoostRegressorQuickAdapterV35.py +++ b/quickadapter/user_data/freqaimodels/XGBoostRegressorQuickAdapterV35.py @@ -270,22 +270,24 @@ class XGBoostRegressorQuickAdapterV35(BaseRegressionModel): fit_live_predictions_candles: int, label_period_candles: int, ) -> tuple[float, float]: - predictions_smoothing = self.freqai_info.get("predictions_smoothing", "mean") - if predictions_smoothing == "quantile": + prediction_thresholds_smoothing = self.freqai_info.get( + "prediction_thresholds_smoothing", "mean" + ) + if prediction_thresholds_smoothing == "quantile": return self.quantile_min_max_pred( pred_df, fit_live_predictions_candles, label_period_candles ) - elif predictions_smoothing == "mean": + elif prediction_thresholds_smoothing == "mean": return mean_min_max_pred( pred_df, fit_live_predictions_candles, label_period_candles ) - elif predictions_smoothing == "median": + elif prediction_thresholds_smoothing == "median": return median_min_max_pred( pred_df, fit_live_predictions_candles, label_period_candles ) else: raise ValueError( - f"Invalid predictions_smoothing value: '{predictions_smoothing}'" + f"Invalid prediction_thresholds_smoothing value: '{prediction_thresholds_smoothing}'" ) def optuna_hp_enqueue_previous_best_trial( -- 2.43.0