Interpretable rule ensembles via gradient boosting
Project description
ruleboost
Learn additive rule ensembles via gradient boosting.
Usage
>>> from ruleboost import RuleBoostingClassifier
>>> import numpy as np
>>> x = np.array([[0.1], [0.2], [0.3], [0.4], [0.5], [0.6], [0.7], [0.8], [0.9]])
>>> y = np.array([0, 0, 0, 1, 1, 1, 0, 0, 0])
>>> model = RuleBoostingClassifier(num_rules=1, fit_intercept=True).fit(x, y)
>>> print(model.rules_str()) # doctest: +NORMALIZE_WHITESPACE
-0.475 if
+0.675 if x1 >= 0.400 & x1 <= 0.600
>>> model.predict(x)
array([0, 0, 0, 1, 1, 1, 0, 0, 0])
>>> np.round(model.predict_proba(x)[:, 1], 2)
array([0.38, 0.38, 0.38, 0.55, 0.55, 0.55, 0.38, 0.38, 0.38])
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
ruleboost-0.3.0.tar.gz
(5.2 kB
view details)
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 ruleboost-0.3.0.tar.gz.
File metadata
- Download URL: ruleboost-0.3.0.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29ede5843d0b3f3b2e8e1ab932e66a699c81828cbd032205ec089dd64246521f
|
|
| MD5 |
499221d33a8c34cfbf54119c466b4092
|
|
| BLAKE2b-256 |
ccf2eeacc5c1039447edf8ee391fd4722613ff51bcc848eda367e7330389e0fe
|
File details
Details for the file ruleboost-0.3.0-py3-none-any.whl.
File metadata
- Download URL: ruleboost-0.3.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0597eb37a6986a9be2b1ebd6ecef47adce34f47569ce1cfc40f76dd0cc33c29
|
|
| MD5 |
c68ea29d6083a22a311ca1ba8bcc9008
|
|
| BLAKE2b-256 |
2f694479fc433d8cda81b95a57a22b5ba7892994b1913034a08b513fd6e3873b
|