API: Calibration
Split-conformal calibration normalized by a DEUP uncertainty scale.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
ConformalMethod
|
|
'normalized'
|
alpha
|
float
|
Miscoverage level; target coverage is |
0.1
|
eps
|
float
|
Floor added to the uncertainty scale to avoid division by zero. |
1e-09
|
Notes
Fit on a held-out calibration set that the base model and g did not train
on, otherwise coverage guarantees do not hold. The DEUP estimators handle this by
calibrating on out-of-fold predictions.
fit(y_true, y_pred, uncertainty=None, *, groups=None, y_lower=None, y_upper=None)
Calibrate on a held-out set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y_true
|
ArrayLike
|
Calibration targets and base-model point predictions. |
required |
y_pred
|
ArrayLike
|
Calibration targets and base-model point predictions. |
required |
uncertainty
|
ArrayLike | None
|
The DEUP scale |
None
|
groups
|
ArrayLike | None
|
Per-row group labels ( |
None
|
y_lower
|
ArrayLike | None
|
Pre-fit quantile predictions on the calibration set ( |
None
|
y_upper
|
ArrayLike | None
|
Pre-fit quantile predictions on the calibration set ( |
None
|
predict_interval(y_pred, uncertainty=None, *, groups=None, y_lower=None, y_upper=None)
Return calibrated (lower, upper) interval bounds for new points.
Return a callable X -> g(x) for use as a MAPIE-style normalization function.
MAPIE's locally adaptive conformal methods accept a per-point scale; passing a
fitted DEUP estimator's epistemic estimate as that scale yields DEUP-normalized
conformal intervals inside MAPIE. The returned callable exposes predict so
it can stand in as a residual-scaling model.
Example
from deup import DEUPRegressor from deup.calibration import deup_normalizer model = DEUPRegressor().fit(X_train, y_train) normalizer = deup_normalizer(model) scale = normalizer.predict(X_cal) # == model.predict_epistemic(X_cal)