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)

# Plots (pip install oqboost[plot])
import oqboost.plot as oqp
oqp.plot_importance(clf)              # gain / gain·|coef| bar
oqp.plot_interactions(clf)           # pairwise-interaction heatmap
oqp.plot_explanation(clf, x)         # one-sample additive contributions
oqp.plot_explanation_summary(clf, X) # SHAP-style beeswarm

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.5.tar.gz (29.4 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.5-cp313-cp313-win_amd64.whl (147.9 kB view details)

Uploaded CPython 3.13Windows x86-64

oqboost-2.0.5-cp313-cp313-manylinux_2_28_x86_64.whl (271.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

oqboost-2.0.5-cp313-cp313-macosx_14_0_arm64.whl (389.3 kB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

oqboost-2.0.5-cp312-cp312-win_amd64.whl (147.8 kB view details)

Uploaded CPython 3.12Windows x86-64

oqboost-2.0.5-cp312-cp312-manylinux_2_28_x86_64.whl (271.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

oqboost-2.0.5-cp312-cp312-macosx_14_0_arm64.whl (389.3 kB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

oqboost-2.0.5-cp311-cp311-win_amd64.whl (144.8 kB view details)

Uploaded CPython 3.11Windows x86-64

oqboost-2.0.5-cp311-cp311-manylinux_2_28_x86_64.whl (269.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

oqboost-2.0.5-cp311-cp311-macosx_14_0_arm64.whl (387.0 kB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

oqboost-2.0.5-cp310-cp310-win_amd64.whl (143.9 kB view details)

Uploaded CPython 3.10Windows x86-64

oqboost-2.0.5-cp310-cp310-manylinux_2_28_x86_64.whl (267.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

oqboost-2.0.5-cp310-cp310-macosx_14_0_arm64.whl (385.7 kB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

File details

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

File metadata

  • Download URL: oqboost-2.0.5.tar.gz
  • Upload date:
  • Size: 29.4 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.5.tar.gz
Algorithm Hash digest
SHA256 9766849d188f68f682b62ac3f3505ee53b1b8cb68b63da0d72dc36f6bdccca2a
MD5 0b96c7fbefadfd79a8f42dc3c2044739
BLAKE2b-256 e34d5fa7b3868df937eed4500dbeac4cd695bfba678a14ae3a02a1c9b0a3ea99

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oqboost-2.0.5-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 147.9 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.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 01bbd97a63fffbe2cab2c42ed7620348500b63206f068aa3c11240ec26233107
MD5 72bf5f0d88527eb7f0bea7db1da35198
BLAKE2b-256 e16cb2236f5dc6b5993a0e14455f69d86667a006d8ba776ce76ae1dec728e947

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oqboost-2.0.5-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0744b772d53d02191f38a124bc925e3ea9bd678fea9402f71273693cde82cae4
MD5 77c128243a5863c73e19af952f3e7b18
BLAKE2b-256 c15519179a4985cc2318517450c2e75bc5febc21a815ff3fc0a702669a3755d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oqboost-2.0.5-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 720fe718bfd36bfede77660d3dd8d59975c873e23a7ffc1794ce94b20d1264b4
MD5 d136a2a4c6953483ea818b2b1a635d31
BLAKE2b-256 0846100c0ed2c9a3099e24cc5bce882731b269565e81defff8cb02a995d0bb9b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oqboost-2.0.5-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 147.8 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.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bbc3de7634f36978a95a8b1726b07f7a4b9684ef91d6a21294ec3c0058099357
MD5 7b80ea811cd5e8ea1edfd49e78f6ca73
BLAKE2b-256 ffd7ab5fbc1b7067d61a8fc4fa20e69f04b5bc9839743854b259aeb1748fb708

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oqboost-2.0.5-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a7402028292f1fa1914c09efe585ac5d4ed87f67372a878e8dcce31e93caec27
MD5 785688adf879ba02e61198d0250c4936
BLAKE2b-256 6c89c464d76441d3163310d0d16f5559f3f61b933cef827ea616372845d9f020

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oqboost-2.0.5-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 07c322f186c711fcf6778ee6ee7380934af89d2bd0cd2576f896d8734d17348e
MD5 258be1589e80c2631aae6b8ad19f642c
BLAKE2b-256 909f204633dc323a3f1e2d3616e7d35147e74923635b0c473b6278a6f16dcb5b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oqboost-2.0.5-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 144.8 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.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d6d2e51d425e0530e86f9f59b9e6b7206a122414523e905321c30110d10b1128
MD5 7be0653c37c1d25d98356bc3c7de0947
BLAKE2b-256 435dc44337045875b7ed5085b978f4c02968df1b4274ef295904f6c359006a30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oqboost-2.0.5-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9330350b67dd4a5dde35194deffac3da40009c4c5521130755da0a0faa7a8124
MD5 c65a6374164a1623618f6f7faa37e1de
BLAKE2b-256 205175724d8b3fc14f4ed224e67542c991c061075fd434e2966f14b14db7155e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oqboost-2.0.5-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 d0e7ba984ea413171eddfa954bdd9a9de31707c6c204dbccc4e275e5520a5eb8
MD5 5d393833cb20f94b2565d63ad5867a64
BLAKE2b-256 3ac593b8e146454b9815b4bc481ee6d16dc22543ddf794f3922eeed4a5702f78

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oqboost-2.0.5-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 143.9 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.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 07669158d5f1b1116c7c48dd413a9c25a885929b2f340e60fe7833259ad45b2a
MD5 540216b1b98cf96b79e6ed25895366ef
BLAKE2b-256 7311fa5cce5b4277c10ba182b11a16da897169e22219bf7cec3fec6ff3791c72

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oqboost-2.0.5-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8838439f1fe805f8bac3e3263717f5d38690decf5aa0b5d1322763a85c1edeaf
MD5 1580e853e6b8f5445c430964ef75ca79
BLAKE2b-256 55d03a1bdcc5ff47c2dc294f1859e73a1b2990e5cd50be23651078e3ca4b6a85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oqboost-2.0.5-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 507938e17a9748aa25c4f07eb89864c8dc9d706527b63e36f564c677da221ba4
MD5 8eb63a626907b6f889c99da9cc17e430
BLAKE2b-256 9de061e222f663944d119cc27bfb3da7fa4a4807202a6fb9ed8efdb458a9c855

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