]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
perf(qav3): split evenly fit live predictions window
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 14 Mar 2025 13:59:08 +0000 (14:59 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 14 Mar 2025 13:59:08 +0000 (14:59 +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 24baa087cbfc914d30794e0d89712e80257881b2..1cf89f21528500ebe25a2144a6fc6c3f2fa8a00f 100644 (file)
@@ -590,10 +590,13 @@ def period_objective(
         max_label_period_candles,
         step=candles_step,
     )
-    y_test = y_test.iloc[-fit_live_predictions_candles:].to_numpy()
-    test_weights = test_weights[-fit_live_predictions_candles:]
-    y_pred = y_pred[-fit_live_predictions_candles:]
     label_window: int = label_period_candles * 2
+    label_windows_length: int = (
+        fit_live_predictions_candles // label_window
+    ) * label_window
+    y_test = y_test.iloc[-label_windows_length:].to_numpy()
+    test_weights = test_weights[-label_windows_length:]
+    y_pred = y_pred[-label_windows_length:]
     y_test = [y_test[i : i + label_window] for i in range(0, len(y_test), label_window)]
     test_weights = [
         test_weights[i : i + label_window]
index bdec0f6510249ad4ccd7e20b21d02985d24350c8..0e658843bc89617880270a81339eb05472ee217e 100644 (file)
@@ -598,10 +598,13 @@ def period_objective(
         max_label_period_candles,
         step=candles_step,
     )
-    y_test = y_test.iloc[-fit_live_predictions_candles:].to_numpy()
-    test_weights = test_weights[-fit_live_predictions_candles:]
-    y_pred = y_pred[-fit_live_predictions_candles:]
     label_window: int = label_period_candles * 2
+    label_windows_length: int = (
+        fit_live_predictions_candles // label_window
+    ) * label_window
+    y_test = y_test.iloc[-label_windows_length:].to_numpy()
+    test_weights = test_weights[-label_windows_length:]
+    y_pred = y_pred[-label_windows_length:]
     y_test = [y_test[i : i + label_window] for i in range(0, len(y_test), label_window)]
     test_weights = [
         test_weights[i : i + label_window]