From 39d7b8c54619699e19441708d3bdeea5e360cdb1 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 9 Aug 2024 07:08:07 +0200 Subject: [PATCH] chore: Remove non-suppored callback from XGBRFRegressor According to the XGBoost docs, this probably never worked as it was never supported - but is now raising an error for user clarity. --- .../freqai/prediction_models/XGBoostRFRegressor.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/freqtrade/freqai/prediction_models/XGBoostRFRegressor.py b/freqtrade/freqai/prediction_models/XGBoostRFRegressor.py index 12231ed13..140186075 100644 --- a/freqtrade/freqai/prediction_models/XGBoostRFRegressor.py +++ b/freqtrade/freqai/prediction_models/XGBoostRFRegressor.py @@ -5,7 +5,6 @@ from xgboost import XGBRFRegressor from freqtrade.freqai.base_models.BaseRegressionModel import BaseRegressionModel from freqtrade.freqai.data_kitchen import FreqaiDataKitchen -from freqtrade.freqai.tensorboard import TBCallback logger = logging.getLogger(__name__) @@ -45,7 +44,12 @@ class XGBoostRFRegressor(BaseRegressionModel): model = XGBRFRegressor(**self.model_training_parameters) - model.set_params(callbacks=[TBCallback(dk.data_path)]) + # Callbacks are not supported for XGBRFRegressor, and version 2.1.x started to throw + # the following error: + # NotImplementedError: `early_stopping_rounds` and `callbacks` are not implemented + # for random forest. + + # model.set_params(callbacks=[TBCallback(dk.data_path)]) model.fit( X=X, y=y, @@ -55,6 +59,6 @@ class XGBoostRFRegressor(BaseRegressionModel): xgb_model=xgb_model, ) # set the callbacks to empty so that we can serialize to disk later - model.set_params(callbacks=[]) + # model.set_params(callbacks=[]) return model