Skip to main content

A scikit-learn-compatible regressor that predicts continuous targets via a cascade of binary classifiers bisecting the target's value range.

Project description

BisectionRegressor

A scikit-learn-compatible regressor that predicts continuous targets by recursively bisecting the target's value range, using a binary classifier at each node to decide which half a sample falls into. Predictions are formed by softly blending both branches at every node, weighted by the classifier's confidence (via the law of total expectation), rather than committing to a single hard path.

Works as a drop-in scikit-learn estimator: Pipeline, GridSearchCV, cross_val_score, clone, sample_weight are all supported.

Install

From PyPI:

pip install bisection-regressor

From source, for development:

git clone https://github.com/vihan015/bisection-regressor.git
cd bisection-regressor
pip install -e .

To also run the benchmarks (needs pandas):

pip install -e ".[benchmarks]"

Quick start

from sklearn.datasets import load_diabetes
from sklearn.model_selection import train_test_split
from bisection_regressor import BisectionRegressor

X, y = load_diabetes(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=0)

reg = BisectionRegressor(max_depth=6)
reg.fit(X_train, y_train)
print(reg.score(X_test, y_test))   # R^2

Documentation

  • docs/hyperparameters.md: every hyperparameter explained, plus usage examples covering Pipeline, GridSearchCV (including BisectionForestRegressor's nested params), cross-validation, sample weights, and tree inspection.
  • docs/math_deepdive.md: a from-scratch walkthrough of exactly what fit() and predict() compute internally, and every mathematical concept involved (medians, entropy, the law of total expectation, empirical Bayes shrinkage, probability calibration, bagging), with a fully worked, verified numeric example.

Results

See paper/report.md for the full write-up: how the method was diagnosed and improved from an initial naive design, the mathematical justification for each fix, and 5-fold cross-validated results on three real UCI datasets (Wine Quality, Concrete Compressive Strength, Auto MPG) against standard baselines (Linear Regression, Random Forest, Gradient Boosting, and so on), reported honestly, including where the method does not win.

Reproduce the benchmark yourself: see benchmarks/.

Status

This is a research/experimental estimator, not a production-hardened replacement for gradient boosting or random forests. It's a specific, interpretable structural alternative. See paper/report.md for exactly where it's competitive and where it isn't.

License

MIT. See 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

bisection_regressor-0.2.0.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

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

bisection_regressor-0.2.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file bisection_regressor-0.2.0.tar.gz.

File metadata

  • Download URL: bisection_regressor-0.2.0.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for bisection_regressor-0.2.0.tar.gz
Algorithm Hash digest
SHA256 24c383220307cb1e0244b7ec461b699fa38dece8972c6a69bccd42d5d1237f99
MD5 38c5ea759c7266364ef2e422a7587183
BLAKE2b-256 eb00b6be98dab0f6480fa9cdc376f99248ca4c0e92001b39829824cae35c5625

See more details on using hashes here.

File details

Details for the file bisection_regressor-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for bisection_regressor-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74547723960fe215e74a7da7d98f6e1f84040c718803a2596f15c149e5ef3b68
MD5 888da88591fc4ebb143310369ceda257
BLAKE2b-256 93d2f8e5a6a379079de629c210eb583bd927748f08ed6b9b87fabcc58d6f2103

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