API reference¶
Both estimators are scikit-learn compatible, with fit, then
predict / predict_proba methods. Parameters are documented below; for
guidance on which ones to tweak, see Parameters.
ChimeraBoostRegressor
¶
ChimeraBoostRegressor(
n_estimators=2000,
learning_rate=None,
depth=None,
l2_leaf_reg=1.0,
max_bins=128,
subsample=1.0,
colsample=None,
cat_smoothing=1.0,
cat_n_permutations=4,
early_stopping_rounds=None,
loss="RMSE",
alpha=0.5,
min_child_weight=1.0,
thread_count=None,
random_state=None,
verbose=False,
ordered_boosting=False,
cat_combinations=None,
leaf_estimation_iterations=1,
linear_leaves=None,
linear_lambda=1.0,
cross_features=None,
selection_rounds=100,
early_stopping=True,
validation_fraction=0.2,
n_ensembles=None,
ensemble_n_jobs=-1,
max_samples=0.8,
cat_features=None,
quantize_gradients=True,
)
Bases: RegressorMixin, BaseEstimator
Gradient boosted oblivious trees for regression.
A scikit-learn compatible regressor supporting squared-error, absolute-error, and quantile losses, native categorical features, sample weights, bagging, and exact SHAP attributions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_estimators
|
int
|
Maximum number of boosting rounds (trees). With |
2000
|
learning_rate
|
float or None
|
Shrinkage applied to each tree. |
None
|
depth
|
int or None
|
Depth of each oblivious tree; a depth-d tree makes d splits. |
None
|
l2_leaf_reg
|
float
|
L2 regularization on leaf values. |
1.0
|
max_bins
|
int
|
Histogram bins per numeric feature. |
128
|
subsample
|
float
|
Row subsampling fraction per tree. Below 1.0, rows are drawn by Minimum Variance Sampling (gradient-weighted, unbiased) rather than uniformly. |
1.0
|
colsample
|
float or None
|
Fraction of features eligible for each tree. |
None
|
cat_smoothing
|
float
|
Prior strength for ordered target statistics; higher shrinks rare categories harder toward the global mean. Must be > 0 -- it is the Bayesian pseudocount in the encoder denominator, so 0 is undefined. |
1.0
|
cat_n_permutations
|
int
|
Number of random orderings averaged by the ordered target encoder. |
4
|
early_stopping_rounds
|
int or None
|
Rounds without validation improvement before stopping. |
None
|
loss
|
(RMSE, MAE, Quantile)
|
Training objective. Set the level with |
"RMSE"
|
alpha
|
float
|
Quantile level for |
0.5
|
min_child_weight
|
float
|
Minimum total hessian required on each side of a split. |
1.0
|
thread_count
|
int or None
|
numba thread count. |
None
|
random_state
|
int or None
|
Seed for reproducibility (deterministic for a fixed |
None
|
verbose
|
bool
|
Print per-round train and validation metrics. |
False
|
ordered_boosting
|
bool
|
Use the leave-one-out leaf training step instead of plain Newton updates. |
False
|
cat_combinations
|
bool or None
|
Add all pairwise categorical-by-categorical features. |
None
|
leaf_estimation_iterations
|
int
|
Newton refinement steps per leaf. |
1
|
linear_leaves
|
bool or None
|
Fit a ridge linear model per leaf over the numeric split features instead
of a constant value, adding local slope where step leaves underfit. Leaves
with too few rows fall back to a constant. Not available with MAE or
quantile loss. |
None
|
linear_lambda
|
float
|
Ridge penalty on per-leaf linear slopes; larger is closer to a constant. |
1.0
|
quantize_gradients
|
bool
|
Run the split search on quantized gradients/hessians packed into
integer histograms (LightGBM-style quantized training, ~15-bit):
~20-25% faster fits at benchmark-flat accuracy. Leaf values always
use the exact float gradients; the rounding noise touches only
split selection and is deterministic for a fixed |
True
|
cross_features
|
bool or None
|
Numeric interaction columns. |
None
|
selection_rounds
|
int or None
|
Round budget for the internal selection fits. The constant/linear-leaf
variants and the pre-cross base fit run at most this many rounds
(auditions, judged on their best validation loss within the budget);
the winning candidate continues to full early stopping, and the
audition winner is refit in full only when the cross-augmented model
loses or cross features do not apply. An audition that early-stops
before the budget is the full fit already (no extra cost). |
100
|
early_stopping
|
bool
|
Hold out a validation split and stop when its score stops improving. |
True
|
validation_fraction
|
float
|
Validation fraction used when |
0.2
|
n_ensembles
|
int or None
|
Number of bagged members. |
None
|
ensemble_n_jobs
|
int
|
Worker processes fitting ensemble members concurrently, each on an
equal share of the thread budget (same total cores as a single fit;
models are identical either way, wall-clock 1.2-2x faster). -1 sizes
the pool from the budget, capped at |
-1
|
max_samples
|
float
|
Fraction of rows each ensemble member trains on, drawn WITHOUT replacement ("subagging"). The default 0.8 beats the classic bootstrap on strength and fit time (a full-size bootstrap holds only ~0.63n unique rows at n rows of compute). 1.0 restores the classic full-size with-replacement bootstrap. Unsampled rows are each member's early-stopping eval set either way. |
0.8
|
cat_features
|
list of int or str, or None
|
Default categorical columns, given as integer positions and/or column
names (names resolved against the DataFrame at fit). Used when |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
feature_importances_ |
ndarray of shape (n_features,)
|
Split-gain importance per input feature, normalized to sum to 1. |
best_iteration_ |
int
|
Number of trees retained after early stopping. |
expected_value_ |
float
|
SHAP baseline (mean prediction over the background); set after calling
|
estimators_ |
list or None
|
Fitted members when |
member_params_ |
dict
|
Bagged-mode member defaults that were auto-applied (params the user
left on auto resolve to tuned member values inside a bag; explicit
values always win). Set only when |
quantile_offset_ |
float
|
Split-conformal correction added to every prediction when
|
linear_leaves_selected_ |
bool or None
|
With |
Source code in chimeraboost/sklearn_api.py
validation_history_
property
¶
Per-round validation loss recorded during fit (RMSE-space loss for
regression), as a list whose length is the number of rounds run. Empty
when no eval_set / early-stopping split was available; for a bagged
model (n_ensembles > 1) a list of the members' histories.
fit
¶
Fit the model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
array - like
|
Training data. |
required |
y
|
array - like
|
Training data. |
required |
cat_features
|
list of int or str, or None
|
Columns to treat as categoricals, given as integer positions and/or
column names (names resolved against the DataFrame). Falls back to the
|
None
|
eval_set
|
(X_val, y_val) tuple or None
|
Explicit validation set. When provided, automatic splitting is skipped regardless of the early_stopping setting. |
None
|
groups
|
array-like of shape (n_samples,) or None
|
Group labels for the samples (e.g. |
None
|
sample_weight
|
array-like of shape (n_samples,) or None
|
Per-sample weights. Normalized to mean 1 internally. Applied
throughout: the gradient/leaf fit, the categorical target encoder,
the quantile bin borders, and the early-stopping metric on an
automatically split (or bagged out-of-bag) validation set, so a
zero-weight row never influences the model. An explicitly passed
|
None
|
callbacks
|
callable or list of callable, or None
|
Per-round fit hooks |
None
|
Source code in chimeraboost/sklearn_api.py
staged_predict
¶
Yield the prediction after each successive tree (the conformal
quantile offset, a post-fit constant, is included in every stage so the
final stage equals predict).
Source code in chimeraboost/sklearn_api.py
shap_values
¶
Exact interventional TreeSHAP contributions to the predicted target.
Returns an array of shape (n_samples, n_features) whose rows sum to
predict(X) - expected_value_, where expected_value_ (set as an
attribute by this call) is the mean prediction over the background. Each
entry is a feature's signed additive contribution to the prediction;
linear-leaf slopes are included exactly. Averaged across the bag when
n_ensembles > 1 (the bag prediction is the members' mean, so the
averaged attribution stays exact). X_background overrides the
reference distribution (default: a sample of the training data).
Source code in chimeraboost/sklearn_api.py
ChimeraBoostClassifier
¶
ChimeraBoostClassifier(
n_estimators=2000,
learning_rate=None,
depth=6,
l2_leaf_reg=1.0,
max_bins=128,
subsample=1.0,
colsample=None,
cat_smoothing=1.0,
cat_n_permutations=4,
early_stopping_rounds=None,
min_child_weight=None,
thread_count=None,
random_state=None,
verbose=False,
ordered_boosting=False,
cat_combinations=None,
leaf_estimation_iterations=None,
linear_leaves=None,
linear_lambda=1.0,
cross_features=None,
selection_rounds=100,
early_stopping=True,
validation_fraction=0.2,
n_ensembles=None,
ensemble_n_jobs=-1,
max_samples=0.8,
cat_features=None,
quantize_gradients=True,
)
Bases: ClassifierMixin, BaseEstimator
Gradient boosted oblivious trees for classification.
A scikit-learn compatible classifier. Uses binary logloss for 2 classes and
softmax for 3 or more, chosen automatically. predict_proba is temperature
scaled on the validation split for calibrated probabilities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_estimators
|
int
|
Maximum number of boosting rounds (trees). With |
2000
|
learning_rate
|
float or None
|
Shrinkage applied to each tree. |
None
|
depth
|
int
|
Depth of each oblivious tree; a depth-d tree makes d splits. |
6
|
l2_leaf_reg
|
float
|
L2 regularization on leaf values. |
1.0
|
max_bins
|
int
|
Histogram bins per numeric feature. |
128
|
subsample
|
float
|
Row subsampling fraction per tree (Minimum Variance Sampling below 1.0). |
1.0
|
colsample
|
float or None
|
Fraction of features eligible for each tree. |
None
|
cat_smoothing
|
float
|
Prior strength for ordered target statistics. Must be > 0 (a Bayesian pseudocount in the encoder denominator; 0 is undefined). |
1.0
|
cat_n_permutations
|
int
|
Number of random orderings averaged by the ordered target encoder. |
4
|
early_stopping_rounds
|
int or None
|
Rounds without validation improvement before stopping. |
None
|
min_child_weight
|
float or None
|
Minimum total hessian on each side of a split. |
None
|
thread_count
|
int or None
|
numba thread count. |
None
|
random_state
|
int or None
|
Seed for reproducibility (deterministic for a fixed |
None
|
verbose
|
bool
|
Print per-round train and validation metrics. |
False
|
ordered_boosting
|
bool
|
Use the leave-one-out leaf training step instead of plain Newton updates. |
False
|
cat_combinations
|
bool or None
|
Add all pairwise categorical-by-categorical features. |
None
|
leaf_estimation_iterations
|
int or None
|
Extra Newton refinement steps per leaf. |
None
|
linear_leaves
|
bool or None
|
Fit a ridge linear model per leaf over the numeric split features instead
of a constant. |
None
|
linear_lambda
|
float
|
Ridge penalty on per-leaf linear slopes; larger is closer to a constant. |
1.0
|
quantize_gradients
|
bool
|
Run the split search on quantized gradients/hessians packed into
integer histograms (LightGBM-style quantized training, ~15-bit):
~20-25% faster fits at benchmark-flat accuracy. Leaf values always
use the exact float gradients; the rounding noise touches only
split selection and is deterministic for a fixed |
True
|
cross_features
|
bool or None
|
Numeric interaction columns. |
None
|
selection_rounds
|
int or None
|
Round budget for the pre-cross base fit when the cross-features refit
will run. The base fit is an audition capped at this many rounds;
the candidates are judged on their best validation loss within the
budget, the winner continues to full early stopping, and the base is
refit in full only if the augmented model loses after being
truncated by the cap. |
100
|
early_stopping
|
bool
|
Hold out a stratified validation split and stop when it stops improving.
|
True
|
validation_fraction
|
float
|
Validation fraction used when |
0.2
|
n_ensembles
|
int or None
|
Number of bagged members. |
None
|
ensemble_n_jobs
|
int
|
Worker processes fitting ensemble members concurrently, each on an
equal share of the thread budget (same total cores as a single fit;
models are identical either way, wall-clock 1.2-2x faster). -1 sizes
the pool from the budget, capped at |
-1
|
max_samples
|
float
|
Fraction of rows each ensemble member trains on, drawn WITHOUT replacement ("subagging"). The default 0.8 beats the classic bootstrap on strength and fit time (a full-size bootstrap holds only ~0.63n unique rows at n rows of compute). 1.0 restores the classic full-size with-replacement bootstrap. Unsampled rows are each member's early-stopping eval set either way. |
0.8
|
cat_features
|
list of int or str, or None
|
Default categorical columns, given as integer positions and/or column
names (names resolved against the DataFrame at fit). Used when |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
classes_ |
ndarray
|
Class labels, in the column order of |
feature_importances_ |
ndarray of shape (n_features,)
|
Split-gain importance per input feature, normalized to sum to 1. |
best_iteration_ |
int
|
Number of trees retained after early stopping. |
temperature_ |
float
|
Fitted calibration temperature; > 1 means raw scores were over-confident. |
expected_value_ |
float
|
SHAP baseline (binary only); set after calling |
estimators_ |
list or None
|
Fitted members when |
member_params_ |
dict
|
Bagged-mode member defaults that were auto-applied (params the user
left on auto resolve to tuned member values inside a bag; explicit
values always win). Set only when |
Source code in chimeraboost/sklearn_api.py
validation_history_
property
¶
Per-round validation loss recorded during fit (binary or softmax
log loss), as a list whose length is the number of rounds run. Empty when
no eval_set / early-stopping split was available; for a bagged model
(n_ensembles > 1) a list of the members' histories.
fit
¶
Fit the model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
array - like
|
Training data. |
required |
y
|
array - like
|
Training data. |
required |
cat_features
|
list of int or str, or None
|
Columns to treat as categoricals, given as integer positions and/or
column names (names resolved against the DataFrame). Falls back to the
|
None
|
eval_set
|
(X_val, y_val) tuple or None
|
Explicit validation set with original class labels. When provided, automatic splitting is skipped. |
None
|
groups
|
array-like of shape (n_samples,) or None
|
Group labels (e.g. |
None
|
sample_weight
|
array-like of shape (n_samples,) or None
|
Per-sample weights. Normalized to mean 1 internally. Applied
throughout: the gradient/leaf fit, the categorical target encoder,
the quantile bin borders, and the early-stopping metric on an
automatically split (or bagged out-of-bag) validation set, so a
zero-weight row never influences the model. An explicitly passed
|
None
|
callbacks
|
callable or list of callable, or None
|
Per-round fit hooks |
None
|
Source code in chimeraboost/sklearn_api.py
1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 | |
shap_values
¶
Exact interventional TreeSHAP contributions in LOG-ODDS (margin) space.
Binary only. Returns an array of shape (n_samples, n_features) whose
rows sum to raw_log_odds(X) - expected_value_ (pre-temperature), with
expected_value_ set as an attribute. Each entry is a feature's signed
contribution to the log-odds of the positive class; linear-leaf slopes are
included exactly. Averaged across the bag when n_ensembles > 1 (an
additive surrogate for the soft-voted probability). Multiclass is not
supported yet. X_background overrides the reference distribution.