
Open-Source ML Models for Quantitative Finance
Machine learning trading algorithms apply statistical learning models — gradient boosting, neural networks, and transformers — to financial time-series data to predict price movements or generate trading signals. These open-source implementations cover both regression (price target) and classification (direction) formulations.
How ML algorithms connect across libraries
How ML algorithms work together in a trading system
Price, volume, indicators
Model predictions
Signal threshold filtering
Profit taking & stop loss
Position sizing & portfolio
Compare ML algorithms across key dimensions
| Metric | LightGBMRegressorFreqtrade | LightGBMClassifierFreqtrade | XGBoostRegressorFreqtrade | XGBoostClassifierFreqtrade | CatboostRegressorFreqtrade | PyTorchMLPRegressorFreqtrade | PyTorchTransformerRegressorFreqtrade | LGBModelQlib (Microsoft) | XGBModelQlib (Microsoft) | DNNModelQlib (Microsoft) | ALSTMQlib (Microsoft) | TFTModelQlib (Microsoft) | GATsQlib (Microsoft) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Complexity | ⭐⭐⭐intermediate | ⭐⭐⭐intermediate | ⭐⭐⭐intermediate | ⭐⭐⭐intermediate | ⭐⭐⭐intermediate | ⭐⭐⭐⭐advanced | ⭐⭐⭐⭐advanced | ⭐⭐⭐intermediate | ⭐⭐⭐intermediate | ⭐⭐⭐⭐advanced | ⭐⭐⭐⭐advanced | ⭐⭐⭐⭐advanced | ⭐⭐⭐⭐advanced |
| Prediction Type | Regression | Classification | Regression | Classification | Regression | Regression | Regression | Mixed | Mixed | Mixed | Sequence | Mixed | Mixed |
| Training Speed | ⚡⚡⚡ | ⚡⚡⚡ | ⚡⚡⚡ | ⚡⚡⚡ | ⚡⚡ | ⚡⚡ | ⚡ | ⚡⚡ | ⚡⚡ | ⚡⚡ | ⚡ | ⚡⚡ | ⚡⚡ |
| Accuracy | 📊📊📊 | 📊📊📊 | 📊📊📊 | 📊📊📊 | 📊📊📊 | 📊📊📊 | 📊📊📊📊 | 📊📊 | 📊📊 | 📊📊 | 📊📊📊 | 📊📊 | 📊📊📊📊 |
| Best For | Tabular data | Tabular data | Tabular data | Tabular data | General purpose | Non-linear patterns | Time series patterns | General purpose | General purpose | General purpose | Sequential data | General purpose | Graph relationships |
Gradient boosting regression model for price movement prediction using LightGBM.
| n_estimators | 1000 | Number of boosting rounds |
| learning_rate | 0.01 | Step size shrinkage |
freqai/prediction_models/LightGBMRegressor.pyGradient boosting classification model for directional prediction (up/down/neutral).
| n_estimators | 1000 | Number of boosting rounds |
freqai/prediction_models/LightGBMClassifier.pyXGBoost-based regression model for continuous value prediction.
| n_estimators | 1000 | Number of boosting rounds |
| max_depth | 6 | Maximum tree depth |
freqai/prediction_models/XGBoostRegressor.pyXGBoost-based classification model for directional prediction.
| n_estimators | 1000 | Number of boosting rounds |
freqai/prediction_models/XGBoostClassifier.pyCatBoost gradient boosting model with native categorical feature support.
| iterations | 1000 | Number of boosting iterations |
freqai/prediction_models/CatboostRegressor.pyMulti-layer perceptron neural network for regression-based price prediction.
| hidden_dim | 128 | Hidden layer dimension |
| dropout_percent | 0.2 | Dropout rate |
freqai/prediction_models/PyTorchMLPRegressor.pyLightGBM model for stock return prediction using technical and fundamental features.
| num_leaves | 31 | Maximum number of leaves |
| learning_rate | 0.1 | Boosting learning rate |
qlib/contrib/model/gbdt.pyXGBoost model for stock return prediction.
qlib/contrib/model/xgboost.pyDeep neural network for nonlinear feature extraction and return prediction.
| hidden_size | 256 | Hidden layer size |
qlib/contrib/model/pytorch_nn.pyAttention-based LSTM for sequential stock data modeling with attention mechanism.
| hidden_size | 64 | LSTM hidden size |
| num_layers | 2 | Number of LSTM layers |
qlib/contrib/model/pytorch_alstm.pyTemporal Fusion Transformer combining static and temporal features for multi-horizon prediction.
qlib/contrib/model/pytorch_tft.py