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
|
(auto, True, False)
|
Calibrate the intervals by conformalized quantile regression, as a
per-level scale about the predicted median. |
"auto"
|
calibration_fraction
|
float
|
Share of training rows reserved for conformalization. Ignored unless
|
0.2
|
audition
|
bool
|
Choose per fit among five candidates on the evaluation rows and keep
the lowest CRPS. H is the head as configured; B is the same booster
with |
True
|
refit_full
|
bool
|
Retrain the winner on all rows after early stopping chose the
budget, as |
True
|
Attributes:
| Name | Type | Description |
|---|---|---|
model_ |
MultiQuantileBoosting
|
The fitted head booster (the 254-bin booster for a bins win). Stays the head even when S or N wins; then it delivers nothing but stays inspectable. |
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 when
the fit left the raw grid untouched ( |
audition_ |
dict or None
|
|
refit_ |
dict or None
|
|
Notes
Every other parameter carries its usual ChimeraBoost meaning. Two defaults
are set for this head rather than inherited: depth is 6 -- deep leaves
narrow the tails, which the default "auto" calibration repairs -- and
min_child_weight follows a floor implied by the most extreme level on
the grid.
Source code in chimeraboost/quantile_api.py
best_iteration_
property
¶
Best round of the winner's booster (the head's for R, the centre model's for S and N).
validation_history_
property
¶
Per-round validation score from fit (empty without a validation
set). The winner's booster's CRPS for a head, bins or recentred
win (the head's for R); the centre model's squared-error
validation loss (RMSE space) for a fixed or scaled win.
feature_importances_
property
¶
Split-gain importances from the winner's booster (the head's for R, the centre model's for S and N).
fit
¶
Fit the model. Arguments carry the same meaning as
ChimeraBoostRegressor.fit.
Source code in chimeraboost/quantile_api.py
618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 | |
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.
Serves the audition winner (audition_): the head, the 254-bin
head, the recentred grid, the fixed-offset grid, or the scaled grid.
Source code in chimeraboost/quantile_api.py
1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 | |
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.
Serves the audition winner, like predict.
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. For a recentred win each
head stage is moved onto the final centre and scaled by R's factors.
For a fixed win each centre-model stage carries the final q_s; for a
scaled win each centre-model stage carries the final spread and q_n.
Serves the audition winner.
Source code in chimeraboost/quantile_api.py
score
¶
Negative CRPS (mean pinball loss over the grid). Higher is better, per the sklearn convention. Serves the audition winner.
Source code in chimeraboost/quantile_api.py
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.
Serves the audition winner.
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.
Serves the audition winner. For a recentred win the delivered grid is
linear in the head's raw channels plus the centre prediction, so the
attribution is exact: the head's mapped through v -> s * (v -
centre(v)), plus the centre model's own shap_values on every
level, its offset folded into the expected value. For a fixed win
every level is the centre prediction plus a constant, so the
attribution is the centre model's own SHAP on every level
(kind="width" is exactly zero). For a scaled win each level is
c(x) + s(x) * k_tau, so the attribution is the centre model's
SHAP plus k_tau times the spread model's SHAP -- exact wherever
the spread sits above its floor, approximate on floored rows.
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
1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 | |
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.