Getting Started
Install zoneboost and fit your first model in a few lines.
Installation
zoneboost is currently published on TestPyPI only (not yet on real PyPI):
pip install -i https://test.pypi.org/simple/ zoneboost
zoneboost has three runtime dependencies — numpy, pandas, and scikit-learn — and no compiled extensions, so installation is a plain wheel install on any platform.
Quickstart
Both estimators accept a pandas DataFrame directly. Declare which columns are
nominal categories with categorical_features; everything else is treated
as continuous and split into data-driven zones automatically.
Regression
import pandas as pd
from zoneboost import ZoneBoostRegressor
X = pd.DataFrame({
"rooms": [3, 4, 2, 5, 3, 4, 2, 5],
"distance_km": [5.0, 2.0, 8.0, 1.0, 6.0, 3.0, 7.5, 1.5],
"neighborhood": ["a", "b", "a", "b", "a", "b", "a", "b"],
})
y = [300, 450, 220, 520, 310, 470, 230, 510]
model = ZoneBoostRegressor(
categorical_features=["neighborhood"], random_state=0
)
model.fit(X, y)
model.predict(X)
Classification
from zoneboost import ZoneBoostClassifier
y_class = [0, 1, 0, 1, 0, 1, 0, 1]
clf = ZoneBoostClassifier(
categorical_features=["neighborhood"], random_state=0
)
clf.fit(X, y_class)
clf.predict_proba(X) # (n_samples, n_classes), rows sum to 1
clf.predict(X) # works for binary and 3+ classes (native multinomial) alike
Both continuous and categorical columns accept
NaN/None
directly — no imputation step needed before calling fit. See
Missing Values for how that's handled
internally.
Requirements
| Dependency | Minimum version |
|---|---|
| Python | >=3.9 |
| numpy | >=1.23 |
| pandas | >=1.5 |
| scikit-learn | >=1.2 |
Development
Working on zoneboost itself:
pip install -e ".[dev]"
pytest
Source and issue tracker: github.com/stainaz/zoneboost.