Skip to content

Commit 9baa6ee

Browse files
authored
Merge pull request freqtrade#12649 from freqtrade/maint/remove_catboost
Remove catboost dependency
2 parents 0feec25 + d2c4bd1 commit 9baa6ee

15 files changed

+26
-303
lines changed

docs/deprecated.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,13 @@ you can verify this with `freqtrade list-data --exchange <yourexchange> --show`.
135135
Additional arguments to the above commands may be necessary, like configuration files or explicit user_data if they deviate from the default.
136136
137137
**Hyperliquid** is a special case now - which will no longer require 1h mark data - but will use regular candles instead (this data never existed and is identical to 1h futures candles). As we don't support download-data for hyperliquid (they don't provide historic data) - there won't be actions necessary for hyperliquid users.
138+
139+
## Catboost models in freqAI
140+
141+
CatBoost models have been removed with version 2025.12 and are no longer actively supported.
142+
If you have existing bots using CatBoost models, you can still use them in your custom models by copy/pasting them from the git history (as linked below) and installing the Catboost library manually.
143+
We do however recommend switching to other supported model libraries like LightGBM or XGBoost for better support and future compatibility.
144+
145+
* [CatboostRegressor](https://github.com/freqtrade/freqtrade/blob/c6f3b0081927e161a16b116cc47fb663f7831d30/freqtrade/freqai/prediction_models/CatboostRegressor.py)
146+
* [CatboostClassifier](https://github.com/freqtrade/freqtrade/blob/c6f3b0081927e161a16b116cc47fb663f7831d30/freqtrade/freqai/prediction_models/CatboostClassifier.py)
147+
* [CatboostClassifierMultiTarget](https://github.com/freqtrade/freqtrade/blob/c6f3b0081927e161a16b116cc47fb663f7831d30/freqtrade/freqai/prediction_models/CatboostClassifierMultiTarget.py)

docs/freqai-configuration.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,15 @@ If this value is set, FreqAI will initially use the predictions from the trainin
200200

201201
## Using different prediction models
202202

203-
FreqAI has multiple example prediction model libraries that are ready to be used as is via the flag `--freqaimodel`. These libraries include `CatBoost`, `LightGBM`, and `XGBoost` regression, classification, and multi-target models, and can be found in `freqai/prediction_models/`.
203+
FreqAI has multiple example prediction model libraries that are ready to be used as is via the flag `--freqaimodel`. These libraries include `LightGBM`, and `XGBoost` regression, classification, and multi-target models, and can be found in `freqai/prediction_models/`.
204204

205205
Regression and classification models differ in what targets they predict - a regression model will predict a target of continuous values, for example what price BTC will be at tomorrow, whilst a classifier will predict a target of discrete values, for example if the price of BTC will go up tomorrow or not. This means that you have to specify your targets differently depending on which model type you are using (see details [below](#setting-model-targets)).
206206

207207
All of the aforementioned model libraries implement gradient boosted decision tree algorithms. They all work on the principle of ensemble learning, where predictions from multiple simple learners are combined to get a final prediction that is more stable and generalized. The simple learners in this case are decision trees. Gradient boosting refers to the method of learning, where each simple learner is built in sequence - the subsequent learner is used to improve on the error from the previous learner. If you want to learn more about the different model libraries you can find the information in their respective docs:
208208

209-
* CatBoost: https://catboost.ai/en/docs/
210-
* LightGBM: https://lightgbm.readthedocs.io/en/v3.3.2/#
211-
* XGBoost: https://xgboost.readthedocs.io/en/stable/#
209+
* LightGBM: <https://lightgbm.readthedocs.io/en/v3.3.2/#>
210+
* XGBoost: <https://xgboost.readthedocs.io/en/stable/#>
211+
* CatBoost: <https://catboost.ai/en/docs/> (No longer actively supported since 2025.12)
212212

213213
There are also numerous online articles describing and comparing the algorithms. Some relatively lightweight examples would be [CatBoost vs. LightGBM vs. XGBoost — Which is the best algorithm?](https://towardsdatascience.com/catboost-vs-lightgbm-vs-xgboost-c80f40662924#:~:text=In%20CatBoost%2C%20symmetric%20trees%2C%20or,the%20same%20depth%20can%20differ.) and [XGBoost, LightGBM or CatBoost — which boosting algorithm should I use?](https://medium.com/riskified-technology/xgboost-lightgbm-or-catboost-which-boosting-algorithm-should-i-use-e7fda7bb36bc). Keep in mind that the performance of each model is highly dependent on the application and so any reported metrics might not be true for your particular use of the model.
214214

@@ -219,7 +219,7 @@ Make sure to use unique names to avoid overriding built-in models.
219219

220220
#### Regressors
221221

222-
If you are using a regressor, you need to specify a target that has continuous values. FreqAI includes a variety of regressors, such as the `CatboostRegressor`via the flag `--freqaimodel CatboostRegressor`. An example of how you could set a regression target for predicting the price 100 candles into the future would be
222+
If you are using a regressor, you need to specify a target that has continuous values. FreqAI includes a variety of regressors, such as the `LightGBMRegressor`via the flag `--freqaimodel LightGBMRegressor`. An example of how you could set a regression target for predicting the price 100 candles into the future would be
223223

224224
```python
225225
df['&s-close_price'] = df['close'].shift(-100)
@@ -229,7 +229,7 @@ If you want to predict multiple targets, you need to define multiple labels usin
229229

230230
#### Classifiers
231231

232-
If you are using a classifier, you need to specify a target that has discrete values. FreqAI includes a variety of classifiers, such as the `CatboostClassifier` via the flag `--freqaimodel CatboostClassifier`. If you elects to use a classifier, the classes need to be set using strings. For example, if you want to predict if the price 100 candles into the future goes up or down you would set
232+
If you are using a classifier, you need to specify a target that has discrete values. FreqAI includes a variety of classifiers, such as the `LightGBMClassifier` via the flag `--freqaimodel LightGBMClassifier`. If you elects to use a classifier, the classes need to be set using strings. For example, if you want to predict if the price 100 candles into the future goes up or down you would set
233233

234234
```python
235235
df['&s-up_or_down'] = np.where( df["close"].shift(-100) > df["close"], 'up', 'down')

freqtrade/freqai/base_models/BaseClassifierModel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class BaseClassifierModel(IFreqaiModel):
1818
"""
1919
Base class for regression type models (e.g. Catboost, LightGBM, XGboost etc.).
2020
User *must* inherit from this class and set fit(). See example scripts
21-
such as prediction_models/CatboostClassifier.py for guidance.
21+
such as prediction_models/XGBoostClassifier.py for guidance.
2222
"""
2323

2424
def train(self, unfiltered_df: DataFrame, pair: str, dk: FreqaiDataKitchen, **kwargs) -> Any:

freqtrade/freqai/base_models/BaseRegressionModel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class BaseRegressionModel(IFreqaiModel):
1818
"""
1919
Base class for regression type models (e.g. Catboost, LightGBM, XGboost etc.).
2020
User *must* inherit from this class and set fit(). See example scripts
21-
such as prediction_models/CatboostRegressor.py for guidance.
21+
such as prediction_models/XGBoostRegressor.py for guidance.
2222
"""
2323

2424
def train(self, unfiltered_df: DataFrame, pair: str, dk: FreqaiDataKitchen, **kwargs) -> Any:

freqtrade/freqai/freqai_interface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ def start_backtesting_from_historic_predictions(
948948
return dk
949949

950950
# Following methods which are overridden by user made prediction models.
951-
# See freqai/prediction_models/CatboostPredictionModel.py for an example.
951+
# See freqai/prediction_models/XGBoostRegressor.py for an example.
952952

953953
@abstractmethod
954954
def train(self, unfiltered_df: DataFrame, pair: str, dk: FreqaiDataKitchen, **kwargs) -> Any:
@@ -964,7 +964,7 @@ def train(self, unfiltered_df: DataFrame, pair: str, dk: FreqaiDataKitchen, **kw
964964
def fit(self, data_dictionary: dict[str, Any], dk: FreqaiDataKitchen, **kwargs) -> Any:
965965
"""
966966
Most regressors use the same function names and arguments e.g. user
967-
can drop in LGBMRegressor in place of CatBoostRegressor and all data
967+
can drop in LGBMRegressor in place of XGBoostRegressor and all data
968968
management will be properly handled by Freqai.
969969
:param data_dictionary: Dict = the dictionary constructed by DataHandler to hold
970970
all the training and test data/labels.

freqtrade/freqai/prediction_models/CatboostClassifier.py

Lines changed: 0 additions & 61 deletions
This file was deleted.

freqtrade/freqai/prediction_models/CatboostClassifierMultiTarget.py

Lines changed: 0 additions & 79 deletions
This file was deleted.

freqtrade/freqai/prediction_models/CatboostRegressor.py

Lines changed: 0 additions & 60 deletions
This file was deleted.

freqtrade/freqai/prediction_models/CatboostRegressorMultiTarget.py

Lines changed: 0 additions & 78 deletions
This file was deleted.

freqtrade/freqai/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def plot_feature_importance(
9797
"""
9898
Plot Best and worst features by importance for a single sub-train.
9999
:param model: Any = A model which was `fit` using a common library
100-
such as catboost or lightgbm
100+
such as XGBoost or lightgbm
101101
:param pair: str = pair e.g. BTC/USD
102102
:param dk: FreqaiDataKitchen = non-persistent data container for current coin/loop
103103
:param count_max: int = the amount of features to be loaded per column
@@ -115,6 +115,8 @@ def plot_feature_importance(
115115
for label in models:
116116
mdl = models[label]
117117
if "catboost.core" in str(mdl.__class__):
118+
# CatBoost is no longer actively supported since 2025.12
119+
# However users can still use it in their custom models
118120
feature_importance = mdl.get_feature_importance()
119121
elif "lightgbm.sklearn" in str(mdl.__class__):
120122
feature_importance = mdl.feature_importances_

0 commit comments

Comments
 (0)