Interval Calibration for Regression#

Conformal prediction provides uncertainty estimates, generating prediction intervals for regressors and confidence sets for classifiers. This ensures that model predictions include a measure of reliability, particularly important for risk-sensitive applications. See details in split_conformal.

The calibrate_interval method allows users to fit an interval model for conformal prediction.

1. Prepare data and model#

from modeva import DataSet
from modeva.models import MoXGBRegressor

ds = DataSet()
ds.load(name="BikeSharing")
ds.set_random_split()

model = MoXGBRegressor(max_depth=2)
model.fit(ds.train_x, ds.train_y)

2. Calibration#

model.calibrate_interval(X_test, y_test, alpha=0.1)

The predict_interval method then applies the calibrated prediction intervals.

3. Get calibrated prediction intervals#

Conformal prediction assumes that the calibration data is representative of the test distribution. If the data distribution shifts significantly, recalibration may be necessary.

Examples#