Skip to main content

OQBoost 2.0 — gradient-boosted 2D-oblique decision trees (histogram-binned, C++ backend)

Project description

OQBoost 2.0

Gradient-boosted 2D-oblique decision trees — histogram-binned, C++ backend.

OQBoost splits on oblique hyperplanes over feature pairs (a·u + b·v < t) instead of axis-aligned thresholds, so diagonal and interaction boundaries are represented directly rather than as axis-aligned approximations. Version 2.0 is a histogram-binned 2D-oblique core with a deterministic direction fit.

scikit-learn compatible · compiled C++ (pybind11) + OpenMP · native missing-value handling (NaN routed to a learned bin, no imputation needed).


Install

pip install oqboost

A prebuilt wheel is provided for macOS (arm64, CPython 3.12). On other platforms pip builds from source — needs a C++17 compiler (clang++/g++) and, for parallelism, OpenMP (brew install libomp on macOS).

Quickstart

from oqboost import OQBoostClassifier, OQBoostRegressor

# Binary classification
clf = OQBoostClassifier(
    n_estimators=120, learning_rate=0.06, max_depth=4,
    max_bins=16, subsample=0.8, colsample=0.8, random_state=42,
)
clf.fit(X_train, y_train)
proba = clf.predict_proba(X_test)[:, 1]   # P(class 1)
pred  = clf.predict(X_test)

# Regression (squared error)
reg = OQBoostRegressor(n_estimators=120, learning_rate=0.06)
reg.fit(X_train, y_train)
y_hat = reg.predict(X_test)

Both are drop-in scikit-learn estimators — usable in Pipeline, GridSearchCV, cross_val_score, and clone.

More features

# Imbalanced data: tune the decision threshold on a holdout (probabilities stay
# calibrated; "balanced" maximizes balanced accuracy, "f1" maximizes F1).
clf = OQBoostClassifier(threshold="balanced").fit(X_train, y_train)
clf.decision_threshold_          # the chosen cut

# Robust regression: huber / quantile losses (init = median), optional output clip.
reg = OQBoostRegressor(loss="huber", alpha=0.9, clip=True).fit(X_train, y_train)
q90 = OQBoostRegressor(loss="quantile", alpha=0.9).fit(X_train, y_train)  # 90th pctile

# Monotonic constraints (-1 / 0 / +1 per feature; list or {index: dir} dict),
# enforced through the oblique splits.
reg = OQBoostRegressor(monotone_constraints={0: +1, 3: -1}).fit(X_train, y_train)

# Incremental training: add trees without refitting from scratch.
clf = OQBoostClassifier(n_estimators=100, warm_start=True).fit(X_train, y_train)
clf.set_params(n_estimators=200).fit(X_train, y_train)   # trains only +100 trees

# Native explanations (no SHAP dependency)
clf.feature_importances_         # Σ gain per feature
clf.coefficient_importances_     # Σ gain·|coef| (direction-weighted)
clf.interaction_importances_     # d×d matrix, Σ gain·|a|·|b| — learned feature pairs
phi = clf.explain(X_test)        # (n, n_features) additive contributions
                                 # phi.sum(axis=1) == raw prediction − base (like SHAP)

Key hyperparameters

Param Default Meaning
n_estimators 120 boosting rounds
learning_rate 0.06 shrinkage
max_depth 4 interaction depth (stacked 2D cuts)
max_bins 16 grid / direction-seed resolution (keep small)
subsample 0.8 rows per tree (key overfit lever)
colsample 0.8 features per node
reg_lambda 1.0 L2 regularization
n_screen -1 SIS top-m feature screening (-1 = exhaustive)
threshold "0.5" binary decision cut — "balanced"/"f1" tunes it on a holdout (imbalanced data)
loss "squared" regression loss — "huber"/"quantile" are outlier-robust
alpha 0.9 huber δ-quantile / quantile target
clip False clamp regression output to training target range
monotone_constraints None per-feature monotonicity -1/0/+1 (list or {idx: dir} dict)

Why oblique

Axis-aligned boosters need several stacked cuts to approximate a diagonal boundary, while an oblique split represents it directly. On 2D problems (XOR, Spiral, Checkerboard) OQBoost draws the diagonal boundary with oblique cuts rather than axis-aligned steps. On Optuna-tuned tabular benchmarks it is competitive with the established gradient-boosting libraries.

Full benchmarks, decision-boundary figures, and design notes: https://github.com/cree1116/oqboost-2.0

Note: OQBoost 2.0 is a ground-up rewrite. The original 1.x line — oblique splits via a Deterministic Gradient-Covariance Scan (DGCS) — lives at cree1116/OQBoost. 2.0 replaces the direction finder with a histogram-binned BHC-seeded least-squares fit.


MIT License.

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

oqboost-2.0.4.tar.gz (26.7 kB view details)

Uploaded Source

Built Distributions

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

oqboost-2.0.4-cp313-cp313-win_amd64.whl (145.1 kB view details)

Uploaded CPython 3.13Windows x86-64

oqboost-2.0.4-cp313-cp313-manylinux_2_28_x86_64.whl (268.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

oqboost-2.0.4-cp313-cp313-macosx_14_0_arm64.whl (386.6 kB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

oqboost-2.0.4-cp312-cp312-win_amd64.whl (145.1 kB view details)

Uploaded CPython 3.12Windows x86-64

oqboost-2.0.4-cp312-cp312-manylinux_2_28_x86_64.whl (268.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

oqboost-2.0.4-cp312-cp312-macosx_14_0_arm64.whl (386.6 kB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

oqboost-2.0.4-cp311-cp311-win_amd64.whl (142.0 kB view details)

Uploaded CPython 3.11Windows x86-64

oqboost-2.0.4-cp311-cp311-manylinux_2_28_x86_64.whl (266.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

oqboost-2.0.4-cp311-cp311-macosx_14_0_arm64.whl (384.3 kB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

oqboost-2.0.4-cp310-cp310-win_amd64.whl (141.2 kB view details)

Uploaded CPython 3.10Windows x86-64

oqboost-2.0.4-cp310-cp310-manylinux_2_28_x86_64.whl (264.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

oqboost-2.0.4-cp310-cp310-macosx_14_0_arm64.whl (383.0 kB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

File details

Details for the file oqboost-2.0.4.tar.gz.

File metadata

  • Download URL: oqboost-2.0.4.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for oqboost-2.0.4.tar.gz
Algorithm Hash digest
SHA256 d1f6312b161f5629677193b4d21f1ce61f811b9bc1f707bd78a1fe531fce3dc3
MD5 f3d09a6ac7086f231959418203274ba3
BLAKE2b-256 b06f158f48fc130369ceed202f044778f307a7c130dd0bfb22f4098a8dff85fb

See more details on using hashes here.

File details

Details for the file oqboost-2.0.4-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: oqboost-2.0.4-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 145.1 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for oqboost-2.0.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f540be24ed61f0383088a0f16ac3516b2d6451a9f7af2012b31086356c295909
MD5 f391f2975dc40b8ef8d963392ba6336c
BLAKE2b-256 d0cdff4cbe55981eaf1162a2f361eb323b984a69d73eed4ac153e982d91c7243

See more details on using hashes here.

File details

Details for the file oqboost-2.0.4-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for oqboost-2.0.4-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6d551da3df19432a6973e4f2a918ded4355bc325d9fefa5e4a09ea4b9a502a80
MD5 0b97eee02e754ba5a7f24f43d556a850
BLAKE2b-256 a43a36cb8c8840c4bf299939f7ccbe33dce1474ef64513fb03de54ad6175d494

See more details on using hashes here.

File details

Details for the file oqboost-2.0.4-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for oqboost-2.0.4-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 183de4b78f8a89fb24705c186d893b1011d83bbf777802c1fccb0118ab63d02b
MD5 f15ff61784dfd35f05d33505ddef9504
BLAKE2b-256 1f4640a0bfb468c9601b1bdeb10eb75b1f790b07eecf3ee5d82ee8a8330e1328

See more details on using hashes here.

File details

Details for the file oqboost-2.0.4-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: oqboost-2.0.4-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 145.1 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for oqboost-2.0.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4318ab88b5a52d33629285b7e853567f7f0ec391673acf4c5e96b3b184070be0
MD5 542567715682f86757da9f3d3597cbfc
BLAKE2b-256 037e6fbfba15e036fe294cefa81b9ebfbc536e157eacf3d8450c00e3052afbda

See more details on using hashes here.

File details

Details for the file oqboost-2.0.4-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for oqboost-2.0.4-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7a974231aa8dd178d4eceb81ef75f63313f1db803ecdc49268d2e5adcb6deb42
MD5 d19a49585a81521fafd5048f1070a5a7
BLAKE2b-256 511267743aca6b05838edca9c6e47c713ab3f43030fb35db9e809979bd4f3f52

See more details on using hashes here.

File details

Details for the file oqboost-2.0.4-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for oqboost-2.0.4-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 1e549c95ae8d25beee8f9ed36b420104e9b547e00a8b928eb9edaa74d045a724
MD5 c16374865e2b449bfcaf69f86fcfde63
BLAKE2b-256 9338b9668e9d6cf11584304124bac5145d32f181e25c10071253a82326a0ff14

See more details on using hashes here.

File details

Details for the file oqboost-2.0.4-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: oqboost-2.0.4-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 142.0 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for oqboost-2.0.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bdf883b2e7673cf7c74a6898eb43b0542b81452a1429d58ea64a40d632f86677
MD5 93ff0f9cae72571353e08c7f937bc314
BLAKE2b-256 ade1004c3b3ea5d66cff544d161bb561642759889539d3b5f6b1c1c7524df1e2

See more details on using hashes here.

File details

Details for the file oqboost-2.0.4-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for oqboost-2.0.4-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 151b9c238a63e86015d1e7054d50fc8e77d6ab3e417ac2d8beb529f8ca6a3657
MD5 7f8498baeb2a4248caf9e9944ef9bdb5
BLAKE2b-256 ebde06e299fbec9dfebb7a0ca38d1443cb5865f17039711d611a9bd7c0030ea2

See more details on using hashes here.

File details

Details for the file oqboost-2.0.4-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for oqboost-2.0.4-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 e9307b799bf8bfec270085c041ac5d1317732064ca068ac517e6355f79dc4c15
MD5 c3ccde5a65eed9b5ceca1b27d28a84bc
BLAKE2b-256 f2cc60504d3784d9a29b35b29912162452a8009a022fd964bcb0521b5e84c339

See more details on using hashes here.

File details

Details for the file oqboost-2.0.4-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: oqboost-2.0.4-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 141.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for oqboost-2.0.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b9fe81abe09fbe7423a2bd9b5cb0158cf48dfa09036c0eccb75063bea4526afa
MD5 8d705ebce236bfccbbf3f311d273981a
BLAKE2b-256 b2e2f20093cc59ab88b946ba100132cc16dec5d1dcebf9b4a4f4576f482f38cb

See more details on using hashes here.

File details

Details for the file oqboost-2.0.4-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for oqboost-2.0.4-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d3ea7331af454865d156131fe263246415402b4d981e6c0782660c4526268570
MD5 337467aa9cbdc4c9a6dbc8ab7d4b69e9
BLAKE2b-256 4aca6f6e7c944c9b44c57ef03c5f3332d6b66e76651930a0bf3ea763208c636a

See more details on using hashes here.

File details

Details for the file oqboost-2.0.4-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for oqboost-2.0.4-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 152a6d63a57368a6cac47d1a2b949bb4d7ec167c85a4c36ee2ee830a8012fb99
MD5 31772d68ca2876a0b24bdbe9103d2874
BLAKE2b-256 c235418869a5cf4d7706867e097f3cf7440fb26e8cac9b383978afb298a4cb41

See more details on using hashes here.

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