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.
This commit is contained in:
Matthias 2024-08-09 07:08:07 +02:00
parent 3ca306026b
commit 39d7b8c546

View File

@ -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