Skip to main content

Rust/Python gradient boosting for tabular data

Project description

GTBoost

Gradient boosting for tabular data. Rust core, Python/sklearn API. Native NaN and categorical handling.

Alpha software — APIs may change.

Install

pip install gtboost

From source:

git clone https://github.com/gtboost-org/gtboost.git
cd gtboost
pip install maturin
maturin develop --release

Regression — California housing

from gtboost import GTBoostRegressor
from sklearn.datasets import fetch_california_housing
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error

X, y = fetch_california_housing(return_X_y=True)
Xtr, Xte, ytr, yte = train_test_split(X, y, test_size=0.2, random_state=0)

model = GTBoostRegressor(n_estimators=1000, learning_rate=0.05, max_depth=6, seed=0)
model.fit(Xtr, ytr, eval_set=[(Xte, yte)], early_stopping_rounds=50)

print(mean_squared_error(yte, model.predict(Xte)) ** 0.5)

Classification — diabetes (binarized)

import numpy as np
from gtboost import GTBoostClassifier
from sklearn.datasets import load_diabetes
from sklearn.model_selection import train_test_split

X, y = load_diabetes(return_X_y=True)
y = (y > np.median(y)).astype(int)
Xtr, Xte, ytr, yte = train_test_split(X, y, test_size=0.2, random_state=0)

clf = GTBoostClassifier(n_estimators=500, learning_rate=0.05, max_depth=3, seed=0)
clf.fit(Xtr, ytr, eval_set=[(Xte, yte)], early_stopping_rounds=50)

proba = clf.predict_proba(Xte)[:, 1]

Main features

All are constructor kwargs (defaults shown). Descriptions are mechanical, not benchmark claims.

kwarg default what it does
honest False fit split structure and leaf values on disjoint halves of the data
stein_leaves False positive-part shrinkage of each tree's leaf vector toward the global step
vertical_init False fit per-feature linear effects before the trees
monotone_constraints [] per-feature monotonicity: 1 up, -1 down, 0 none
interval_splits False bounded split candidates a <= x <= b
sparse_oblique_splits False 2-feature diagonal split candidates
grow_policy "depthwise" depthwise / leafwise / oblivious / adaptive
huber_delta 0.0 Huber loss for regression (0.0 = squared error)
n_refine 0 post-fit leaf-value refit passes
apx True average predictions across boosting-trajectory checkpoints
cat_features None mark categorical columns; pandas category/object/string auto-detected

Noisy, small data (diabetes) — structure-honest fit with leaf shrinkage and a linear prior:

reg = GTBoostRegressor(honest=True, stein_leaves=True, vertical_init=True, seed=0)
reg.fit(Xtr, ytr)

Monotone constraint (California, target non-decreasing in feature 0, MedInc):

reg = GTBoostRegressor(monotone_constraints=[1, 0, 0, 0, 0, 0, 0, 0], seed=0)
reg.fit(Xtr, ytr)

Categorical features

Pandas category/object/string columns are detected automatically. Pass cat_features to override. Fit and predict on DataFrames with the same columns so categories map consistently.

clf = GTBoostClassifier(cat_features=["city", "segment"], seed=0)
clf.fit(df_train, y_train)
proba = clf.predict_proba(df_test)

Tuning

from gtboost.tuner import tune_gtboost

result = tune_gtboost(Xtr, ytr, task="regression", n_trials=30, n_folds=3)
model = GTBoostRegressor(**result.best_params).fit(Xtr, ytr)

Refine

Post-hoc joint leaf re-solve (regression, binary, multiclass): re-fits all leaf values against the final residual, shrunk toward the greedy values, behind an evidence gate. See REFINE_2.md.

Scope

Stable: GTBoostRegressor, GTBoostClassifier, Dataset, native NaN and categorical handling, interval splits. A native gtboost.train / Dataset API also exists.

Experimental: research knobs on GTBoostModel — see GTBOOST_FEATURES.md.

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

gtboost-0.1.0a2.tar.gz (370.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

gtboost-0.1.0a2-cp312-cp312-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.12Windows x86-64

gtboost-0.1.0a2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

gtboost-0.1.0a2-cp312-cp312-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

gtboost-0.1.0a2-cp311-cp311-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.11Windows x86-64

gtboost-0.1.0a2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

gtboost-0.1.0a2-cp311-cp311-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

gtboost-0.1.0a2-cp310-cp310-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.10Windows x86-64

gtboost-0.1.0a2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

gtboost-0.1.0a2-cp310-cp310-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file gtboost-0.1.0a2.tar.gz.

File metadata

  • Download URL: gtboost-0.1.0a2.tar.gz
  • Upload date:
  • Size: 370.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gtboost-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 1ccaf8e6eb2ac3d378368eb06dd4ac420b22acf33872cd1f257826959c755518
MD5 151d11f9c0ea713c42e32d78ad4dd0fa
BLAKE2b-256 67fab826fca1201e337b44df8a0b1795b09089cf0c44ec352bd5ef35079ea8b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for gtboost-0.1.0a2.tar.gz:

Publisher: wheels.yml on gtboost-org/gtboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gtboost-0.1.0a2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: gtboost-0.1.0a2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gtboost-0.1.0a2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2335a22b769876d14de658d83d44c3efcaaf73583719e1d8cd5e50ba7d96a0ea
MD5 44f96c570174783f13c56b28cb01a678
BLAKE2b-256 08b8323f2edc34a4865c1e8068e28dfc5f29172512435144156b0c31b800554c

See more details on using hashes here.

Provenance

The following attestation bundles were made for gtboost-0.1.0a2-cp312-cp312-win_amd64.whl:

Publisher: wheels.yml on gtboost-org/gtboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gtboost-0.1.0a2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gtboost-0.1.0a2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3c10353ff66d1260040f2698ff59461f6e990068332badb053967043512dab4e
MD5 0e80da8a3973439392b2d364f01cd2f2
BLAKE2b-256 fbfa023fc5befea4ec1c56e737b48682c991f6adf2d4a2e0589576aa83ea0e67

See more details on using hashes here.

Provenance

The following attestation bundles were made for gtboost-0.1.0a2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: wheels.yml on gtboost-org/gtboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gtboost-0.1.0a2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for gtboost-0.1.0a2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a2ac0163367a76298b5d8e52ebebabf06b607fbb89d9bfbdeaeadb798a768067
MD5 354a9fc441bc1170a3cf560da08748bb
BLAKE2b-256 2eae99923fa8bf58ae35210c270f0cf0467629667f823458809f973be8a92cab

See more details on using hashes here.

Provenance

The following attestation bundles were made for gtboost-0.1.0a2-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: wheels.yml on gtboost-org/gtboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gtboost-0.1.0a2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: gtboost-0.1.0a2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gtboost-0.1.0a2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c7c04b15a5f45340b16347fc4bee18d7fa9de1d9e25dfc819d45dc12d5887f72
MD5 67ff404dd594f38a1a19802c9c75bbe4
BLAKE2b-256 855b8fd31ae027c18c75b2847786c368833494f944f748ba96ed3f387c1ea5fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for gtboost-0.1.0a2-cp311-cp311-win_amd64.whl:

Publisher: wheels.yml on gtboost-org/gtboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gtboost-0.1.0a2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gtboost-0.1.0a2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f5c868841d907329990358857df068b7e5438aea07d69b0d115c664796ee25c1
MD5 711f20710be92b68c20f5519bd040551
BLAKE2b-256 5ff6197172c29b3a196d8ae24e622921b3b400bc9792b4039c35019fcab5c5c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for gtboost-0.1.0a2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: wheels.yml on gtboost-org/gtboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gtboost-0.1.0a2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for gtboost-0.1.0a2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1d451563b19d5349346ad5fd75eb8f766f4e679fcd57c3d1ad6272153bcf4a3d
MD5 735ba3cc63647931b470b8efdc00ba61
BLAKE2b-256 bd0f8979787c6ca07db546ab678a951cb330df78f078f97d3960ebf3f58de907

See more details on using hashes here.

Provenance

The following attestation bundles were made for gtboost-0.1.0a2-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: wheels.yml on gtboost-org/gtboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gtboost-0.1.0a2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: gtboost-0.1.0a2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gtboost-0.1.0a2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c8a6b4825798d3055397ab9c2ebd468b35485ab3a97c42703ae1738cd671f0ea
MD5 a37bfbec6987fe0794eed7530968f70f
BLAKE2b-256 2215c9d48261b6c2707fbf80bf72382ab13dbc8f8039fc2ac93e349b9d739764

See more details on using hashes here.

Provenance

The following attestation bundles were made for gtboost-0.1.0a2-cp310-cp310-win_amd64.whl:

Publisher: wheels.yml on gtboost-org/gtboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gtboost-0.1.0a2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gtboost-0.1.0a2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2609e81408bdb76de97d9e41932584b22ac831ecb90aded42a177a1c5dce34f0
MD5 e7b4c491bc96be634ca92451d13f4d8e
BLAKE2b-256 82dfc358b275baa06cecb5e32da03961ff0e03639705d22ad6474c713bb56fc4

See more details on using hashes here.

Provenance

The following attestation bundles were made for gtboost-0.1.0a2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: wheels.yml on gtboost-org/gtboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gtboost-0.1.0a2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for gtboost-0.1.0a2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 62383fa9c296582e48fb4e6b6194a42a4d55f642aab63e0fba45f6d2ff4306f2
MD5 88903812efe6ee674c6043a0ea153370
BLAKE2b-256 af745859cf13e35d2cc7ca4fba2886250be576f584476067a87e0e086dc041a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for gtboost-0.1.0a2-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: wheels.yml on gtboost-org/gtboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page