mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-14 12:13:57 +00:00
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:
parent
3ca306026b
commit
39d7b8c546
|
@ -5,7 +5,6 @@ from xgboost import XGBRFRegressor
|
||||||
|
|
||||||
from freqtrade.freqai.base_models.BaseRegressionModel import BaseRegressionModel
|
from freqtrade.freqai.base_models.BaseRegressionModel import BaseRegressionModel
|
||||||
from freqtrade.freqai.data_kitchen import FreqaiDataKitchen
|
from freqtrade.freqai.data_kitchen import FreqaiDataKitchen
|
||||||
from freqtrade.freqai.tensorboard import TBCallback
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -45,7 +44,12 @@ class XGBoostRFRegressor(BaseRegressionModel):
|
||||||
|
|
||||||
model = XGBRFRegressor(**self.model_training_parameters)
|
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(
|
model.fit(
|
||||||
X=X,
|
X=X,
|
||||||
y=y,
|
y=y,
|
||||||
|
@ -55,6 +59,6 @@ class XGBoostRFRegressor(BaseRegressionModel):
|
||||||
xgb_model=xgb_model,
|
xgb_model=xgb_model,
|
||||||
)
|
)
|
||||||
# set the callbacks to empty so that we can serialize to disk later
|
# set the callbacks to empty so that we can serialize to disk later
|
||||||
model.set_params(callbacks=[])
|
# model.set_params(callbacks=[])
|
||||||
|
|
||||||
return model
|
return model
|
||||||
|
|
Loading…
Reference in New Issue
Block a user