pitci.base.SplitConformalPredictorMixin

class pitci.base.SplitConformalPredictorMixin(model, n_bins=3)[source]

Bases: object

Mixin class to provide functionality to allow conformal predictors where the intervals are calibrated to different subsets of the data depending on the scaling factor values.

This class should be used with the model specific conformal predictor classes e.g. XGBoosterLeafNodeScaledConformalPredictor to create a new class that include the split conformal predictor functionality. SplitConformalPredictorMixin should the first class in the mulitple inheritance when creating split conformal predictor classes for specific modelling libraries.

Parameters
  • model (Any) – Underlying Any model to generate prediction intervals with.

  • n_bins (int) – Number of bins to split data into based on the scaling factors.

n_bins

Number of bins to split data into based off the scaling factors.

Type

int

bin_quantiles

Quantiles of the scaling factor values that will be used to define the limits of the bins. Attribute is set when the {calibrate_link} method is run.

Type

float

baseline_interval

Baseline intervals calibrated for each of the n_bins subsets of the data. Set by the _calibrate_interval method.

Type

list

scaling_factor_cut_points

The edges of the scaling factor bins that define the data subsets that each of the values in baseline_interval are calibrated on. Set by the _calibrate_interval method.

Type

np.ndarray

__init__(model, n_bins=3)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(model[, n_bins])

Initialize self.