Linear Residual Boosting compatible with scikit-learn.
Project description
lrboost is a sckit-learn compatible package for linear residual boosting. lrboost uses a linear estimator to first remove any linear trends from the data, and then uses a separate non-linear estimator to model the remaining non-linear trends. We find that extrapolation tasks or data with linear and non-linear components are the best use cases. Not every modeling task will benefit from lrboost, but we use this in our own work and wanted to share something that made it easy to use.
For a stable version, install using pip:
pip install lrboost
lrboost was inspired by 'Regression-Enhanced Random Forests' by Haozhe Zhang, Dan Nettleton, and Zhengyuan Zhu. An excellent PyData talk by Gabby Shklovsky explaining the intuition underlying the approach may also be found here: 'Random Forest Best Practices for the Business World'.
- LRBoostRegressor can be used like any other sklearn estimator and is built off a sklearn template.
predict(X)returns an array-like of final predictions- Adding
predict(X, detail=True)returns a dictionary with primary, secondary, and final predictions.
from sklearn.datasets import load_diabetes
from lrboost import LRBoostRegressor
X, y = load_diabetes(return_X_y=True)
lrb = LRBoostRegressor().fit(X, y)
predictions = lrb.predict(X)
detailed_predictions = lrb.predict(X, detail=True)
print(lrb.primary_model.score(X, y)) #R2
print(lrb.score(X, y)) #R2
>>> 0.512
>>> 0.933
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lrboost-0.2.1.tar.gz.
File metadata
- Download URL: lrboost-0.2.1.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65f0ce4866d3b2174afa63c2aaf664ccf66bdd36bc15a6e5df4e9e735aba8671
|
|
| MD5 |
98aeccbadcc010fd41da91ea6be33cf6
|
|
| BLAKE2b-256 |
6fe17c70e3d7e63d5425236eb0d00cfe2bb6458ec953186a9fb11e97f2da34af
|
File details
Details for the file lrboost-0.2.1-py3-none-any.whl.
File metadata
- Download URL: lrboost-0.2.1-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a9e9d4fae76a1cb47dc69c40140fbae16106aa084f8e710ae2580d6a6bbc9f3
|
|
| MD5 |
d10003683cb4b632abd50a55a35b9762
|
|
| BLAKE2b-256 |
5aa956a1321421a3d4989ae6ec7e802ea7805461b95964a19aac13d1c4beb60a
|