diff --git a/docs/freqai-configuration.md b/docs/freqai-configuration.md index 5ab7b2602..29b0c0d70 100644 --- a/docs/freqai-configuration.md +++ b/docs/freqai-configuration.md @@ -200,14 +200,14 @@ If this value is set, FreqAI will initially use the predictions from the trainin ## Using different prediction models -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/`. +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/`. 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)). 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: -* CatBoost: https://catboost.ai/en/docs/ -* LightGBM: https://lightgbm.readthedocs.io/en/v3.3.2/# +* CatBoost: (No longer actively supported since 2025.12) +* LightGBM: * XGBoost: https://xgboost.readthedocs.io/en/stable/# 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. @@ -219,7 +219,7 @@ Make sure to use unique names to avoid overriding built-in models. #### Regressors -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 +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 ```python 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 #### Classifiers -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 +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 ```python df['&s-up_or_down'] = np.where( df["close"].shift(-100) > df["close"], 'up', 'down') diff --git a/freqtrade/freqai/base_models/BaseClassifierModel.py b/freqtrade/freqai/base_models/BaseClassifierModel.py index fe3254792..350a6f0ce 100644 --- a/freqtrade/freqai/base_models/BaseClassifierModel.py +++ b/freqtrade/freqai/base_models/BaseClassifierModel.py @@ -18,7 +18,7 @@ class BaseClassifierModel(IFreqaiModel): """ Base class for regression type models (e.g. Catboost, LightGBM, XGboost etc.). User *must* inherit from this class and set fit(). See example scripts - such as prediction_models/CatboostClassifier.py for guidance. + such as prediction_models/XGBoostClassifier.py for guidance. """ def train(self, unfiltered_df: DataFrame, pair: str, dk: FreqaiDataKitchen, **kwargs) -> Any: diff --git a/freqtrade/freqai/base_models/BaseRegressionModel.py b/freqtrade/freqai/base_models/BaseRegressionModel.py index 75958f4c9..0c7c95569 100644 --- a/freqtrade/freqai/base_models/BaseRegressionModel.py +++ b/freqtrade/freqai/base_models/BaseRegressionModel.py @@ -18,7 +18,7 @@ class BaseRegressionModel(IFreqaiModel): """ Base class for regression type models (e.g. Catboost, LightGBM, XGboost etc.). User *must* inherit from this class and set fit(). See example scripts - such as prediction_models/CatboostRegressor.py for guidance. + such as prediction_models/XGBoostRegressor.py for guidance. """ def train(self, unfiltered_df: DataFrame, pair: str, dk: FreqaiDataKitchen, **kwargs) -> Any: diff --git a/freqtrade/freqai/freqai_interface.py b/freqtrade/freqai/freqai_interface.py index b70b7c67e..b4f37adf1 100644 --- a/freqtrade/freqai/freqai_interface.py +++ b/freqtrade/freqai/freqai_interface.py @@ -948,7 +948,7 @@ class IFreqaiModel(ABC): return dk # Following methods which are overridden by user made prediction models. - # See freqai/prediction_models/CatboostPredictionModel.py for an example. + # See freqai/prediction_models/XGBoostRegressor.py for an example. @abstractmethod def train(self, unfiltered_df: DataFrame, pair: str, dk: FreqaiDataKitchen, **kwargs) -> Any: @@ -964,7 +964,7 @@ class IFreqaiModel(ABC): def fit(self, data_dictionary: dict[str, Any], dk: FreqaiDataKitchen, **kwargs) -> Any: """ Most regressors use the same function names and arguments e.g. user - can drop in LGBMRegressor in place of CatBoostRegressor and all data + can drop in LGBMRegressor in place of XGBoostRegressor and all data management will be properly handled by Freqai. :param data_dictionary: Dict = the dictionary constructed by DataHandler to hold all the training and test data/labels. diff --git a/freqtrade/freqai/utils.py b/freqtrade/freqai/utils.py index d3aeaefe3..7862d78b4 100644 --- a/freqtrade/freqai/utils.py +++ b/freqtrade/freqai/utils.py @@ -97,7 +97,7 @@ def plot_feature_importance( """ Plot Best and worst features by importance for a single sub-train. :param model: Any = A model which was `fit` using a common library - such as catboost or lightgbm + such as XGBoost or lightgbm :param pair: str = pair e.g. BTC/USD :param dk: FreqaiDataKitchen = non-persistent data container for current coin/loop :param count_max: int = the amount of features to be loaded per column @@ -115,6 +115,8 @@ def plot_feature_importance( for label in models: mdl = models[label] if "catboost.core" in str(mdl.__class__): + # CatBoost is no longer actively supported since 2025.12 + # However users can still use it in their custom models feature_importance = mdl.get_feature_importance() elif "lightgbm.sklearn" in str(mdl.__class__): feature_importance = mdl.feature_importances_ diff --git a/freqtrade/templates/FreqaiExampleHybridStrategy.py b/freqtrade/templates/FreqaiExampleHybridStrategy.py index 908c4b174..fca913657 100644 --- a/freqtrade/templates/FreqaiExampleHybridStrategy.py +++ b/freqtrade/templates/FreqaiExampleHybridStrategy.py @@ -20,7 +20,7 @@ class FreqaiExampleHybridStrategy(IStrategy): Launching this strategy would be: freqtrade trade --strategy FreqaiExampleHybridStrategy --strategy-path freqtrade/templates - --freqaimodel CatboostClassifier --config config_examples/config_freqai.example.json + --freqaimodel XGBoostClassifier --config config_examples/config_freqai.example.json or the user simply adds this to their config: diff --git a/freqtrade/templates/FreqaiExampleStrategy.py b/freqtrade/templates/FreqaiExampleStrategy.py index b07487496..6c7de279b 100644 --- a/freqtrade/templates/FreqaiExampleStrategy.py +++ b/freqtrade/templates/FreqaiExampleStrategy.py @@ -205,8 +205,8 @@ class FreqaiExampleStrategy(IStrategy): # If user wishes to use multiple targets, they can add more by # appending more columns with '&'. User should keep in mind that multi targets # requires a multioutput prediction model such as - # freqai/prediction_models/CatboostRegressorMultiTarget.py, - # freqtrade trade --freqaimodel CatboostRegressorMultiTarget + # freqai/prediction_models/LightGBMClassifierMultiTarget.py, + # freqtrade trade --freqaimodel LightGBMClassifierMultiTarget # df["&-s_range"] = ( # df["close"]