ChimeraBoostQuantileRegressor¶
A whole grid of conditional quantiles from a single booster, with levels that cannot cross. See the User Guide: predictive distributions.
Bases: BaseEstimator
Gradient boosting for a whole predictive distribution at once.
One booster, one tree structure per round, and a K-vector in every leaf,
one entry per level in quantiles. Against one quantile regressor per
level that is roughly K times less split-search work, and the predictions
cannot cross: the 30% quantile is never returned above the 70%.
Ordering is enforced per row by monotone rearrangement of the delivered
scores. It is exact for every row and holds at every intermediate stage of
staged_predict. Rearrangement cannot cost accuracy -- sorting a
crossing quantile curve never increases pinball loss at any level
(Chernozhukov, Fernandez-Val & Galichon 2010).
Deliberately not a RegressorMixin: predict returns a matrix, so the
inherited score (which assumes one number per row) would be wrong.
score here is negative CRPS, so higher is better, as sklearn requires.
Read more in the User Guide.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quantiles
|
array - like or None
|
Ascending, unique levels strictly inside (0, 1). Default
0.05, 0.10, ... 0.95. Column k of |
None
|
split_projection
|
(rotate, sum, gram)
|
How split gain is scored across the quantile levels. Keep the default
unless you are experimenting. |
"rotate"
|
exact_splits
|
bool
|
Score splits exactly across every level instead of on a projection. More faithful, but the fit gets slower and more memory-hungry as the grid grows -- a reference setting, not one for routine use. |
False
|
conformalize
|
bool
|
Calibrate the intervals by conformalized quantile regression. Carves
|
False
|
calibration_fraction
|
float
|
Share of training rows reserved for conformalization. Ignored unless
|
0.2
|
Attributes:
| Name | Type | Description |
|---|---|---|
quantiles_ |
ndarray of shape (n_quantiles,)
|
The resolved grid. |
conformal_scale_ |
ndarray of shape (n_quantiles,)
|
Per-level conformal scale about the predicted median; all ones unless
|
Notes
Every other parameter carries its usual ChimeraBoost meaning. Two defaults
are set for this head rather than inherited: depth is 4, because deep
leaves overfit tail quantiles, and min_child_weight follows a floor
implied by the most extreme level on the grid.
Source code in chimeraboost/quantile_api.py
validation_history_
property
¶
Per-round validation CRPS from fit (empty without a validation
set).
fit
¶
Fit the model. Arguments carry the same meaning as
ChimeraBoostRegressor.fit.
Source code in chimeraboost/quantile_api.py
predict
¶
Predict the conditional distribution.
kind="quantiles" (default) returns (n_samples, n_quantiles),
column k being level quantiles_[k], non-decreasing along axis 1.
kind="interval" returns (n_samples, 2): the central 1 - alpha
interval, read off the alpha/2 and 1 - alpha/2 levels, which
must both be on the grid. No interpolation -- an interval the model was
not fitted for is an error, not a guess.
kind="mean" returns (n_samples,), the integral of the quantile
function over tau: trapezoid across the grid plus flat extension of the
edge levels out to 0 and 1. The flat extension is the honest reading of
a finite grid, assuming nothing about tails the model never estimated.
kind="median" returns (n_samples,), the predicted median -- the
0.5 level when the grid carries it, interpolated between its
neighbours when it does not. This is the centre conformalization
rescales about.
kind="cdf" returns (n_samples, n_thresholds): P(y <= t) for
each t in thresholds, by inverting the grid. A 1-D
thresholds is shared by every row; a 2-D (n_samples, T) array is
read row against row -- the rule is dimensionality, never length.
Clamped to the outermost fitted levels rather than to 0 and 1, for
the same reason "mean" extends flat. Warns when the fitted grid
is too coarse to carry a CDF (any inter-level gap above 0.2).
kind="sample" returns (n_samples_rows, n_samples): inverse-
transform draws from the predicted distribution, for feeding a
downstream simulation. random_state seeds them; draws stay inside
the fitted level range.
Unlike "interval", "cdf" and "sample" interpolate between
levels. That is a different question -- reading a fitted curve at a
point, rather than claiming a level was fitted when it was not.
Source code in chimeraboost/quantile_api.py
predict_thresh
¶
Probability of the target landing beyond thresholds.
direction="greater" returns P(y > t); "less" returns
P(y <= t). Both read the same fitted quantile function as
predict(kind="cdf"): linear between grid levels, clamped to the
outermost fitted levels outside them -- on the default grid no
probability reads below 0.05 or above 0.95, because the model never
estimated those tails. A coarse grid (any inter-level gap above 0.2,
e.g. quantiles=[0.1, 0.5, 0.9]) warns: the probabilities would
be mostly interpolation, not estimates.
thresholds may be a scalar (one probability per row, returned
1-D), a 1-D array of T values shared by every row (returns
(n_samples, T)), or a 2-D (n_samples, T) array read row against row
(returns (n_samples, T)). The rule is dimensionality, never length:
stack several per-row threshold lists with np.column_stack.
Source code in chimeraboost/quantile_api.py
staged_predict
¶
Yield the (n, K) quantile matrix after each successive tree. The
conformal rescaling is a post-fit transform, so it is applied at every
stage and the last one equals predict.
Source code in chimeraboost/quantile_api.py
score
¶
Negative CRPS (mean pinball loss over the grid). Higher is better, per the sklearn convention.
report
¶
quantile_metrics.quantile_report on this model's predictions:
CRPS and its skill score, per-level pinball, coverage plus width plus
interval score for every symmetric interval, the PIT histogram, and
the crossing rate.
baseline sets what the skill score is measured against -- pass the
training targets to score against the marginal distribution the model
actually had, rather than the hindsight marginal of y.
Source code in chimeraboost/quantile_api.py
shap_values
¶
shap_values(
X,
X_background=None,
kind="quantiles",
alpha=None,
quantile=None,
space="delivered",
)
Exact interventional TreeSHAP for a predicted quantile grid.
Explains what predict returned. Contributions plus
expected_value_ (set by this call) reconstruct it, level by level.
kind selects the explained quantity:
"quantiles"--(n_samples, n_features, n_quantiles), or(n_samples, n_features)whenquantilenames one fitted level."mean"-- the tau-integrated point prediction."width"-- the width of the central1 - alphainterval: which features make this row's prediction more uncertain, as opposed to higher or lower. Shapley values are linear in the value function, so the difference of two levels' attributions is exactly the attribution of their difference.
space is for one specific job and most callers can ignore it.
Predictions are rearranged on delivery, which relabels a row's levels,
so the default "delivered" measures each row against its own
reordering of the background and expected_value_ is
(n_samples, n_quantiles). Aggregating those across rows mixes rows
that were reordered differently. space="raw" explains the
pre-rearrangement levels instead, against one shared
(n_quantiles,) baseline, which is what makes a cross-row average
meaningful -- shap_importances uses it for exactly that reason. The
two agree on any row whose levels were already in order.
"mean" and "width" are order-dependent by construction and
always read the delivered grid.
Source code in chimeraboost/quantile_api.py
shap_importances
¶
Global SHAP importance: mean(abs(shap_values(X))) per feature.
Averaged over the whole grid by default, or over one level when
quantile names it. Uses space="raw" so that every row is
measured on the same footing -- see shap_values -- which is what a
cross-row average needs.
Returns a structured (feature, importance) array sorted descending,
or a {feature: importance} dict when prettified=True.