Conformal Regression¶
- class caliber.regression.conformal_regression.base.ConformalizedScoreRegressionModel(confidence)[source]¶
-
- abstract predict(*args, **kwargs)¶
- class caliber.regression.conformal_regression.cqr.base.ConformalizedQuantileRegressionModel(confidence, which_quantile='both')[source]¶
-
- threshold()¶
- Return type:
ndarray
- class caliber.regression.conformal_regression.jackknifeplus.base.JackknifePlusRegressionModel(model, coverage, loo_size=100, seed=0, loo_prediction=False)[source]¶
A conformalised bootstrap model based on leave-one-out (LOO). Given inputs and targets, it trains an arbitrary model multiple times with LOO and stores the prediction error on the left-out input. At prediction time, it provides a confidence interval around the mean predicted, with quantiles corrected via the errors stored at training time.
Given a coverage level alpha, a target variable Y and the predicted confidence interval [Q1, Q2], if the training and test sets are IID the algorithm ensures that P(Y in [Q1, Q2]) >= alpha.
- Args:
model (Any): An instantiated model class with fit and predict methods. coverage (float): A coverage value between 0 and 1.
For example, coverage=0.95 means that the target variable will be expected to lay within the confidence interval 95% of the times.
loo_size (int, optional): The number of leave-one-out (LOO) validations. Defaults to 100. seed (int, optional): The random seed. Defaults to 0. loo_prediction (bool, optional): Whether to predict the mean prediction using the leave-one-out models or rather a single model. Defaults to False.
- class caliber.regression.conformal_regression.cvplus.base.CVPlusRegressionModel(model, coverage, num_folds=5, seed=0, cv_prediction=False, max_validation_fold_size=1000)[source]¶
A conformalised bootstrap model based on cross-validation (CV). Given inputs and targets, it trains an arbitrary model multiple times with CV and stores the prediction error on the left-out inputs. At prediction time, it provides a confidence interval around the mean predicted, with quantiles corrected via the errors stored at training time.
Given a coverage level alpha, a target variable Y and the predicted confidence interval [Q1, Q2], if the training and test sets are IID the algorithm ensures that P(Y in [Q1, Q2]) >= alpha.
- Args:
model (Any): An instantiated model class with fit and predict methods. coverage (float): A coverage value between 0 and 1.
For example, coverage=0.95 means that the target variable will be expected to lay within the confidence interval 95% of the times.
num_folds (int, optional): The number of CV folds. Defaults to 5. seed (int, optional): The random seed. Defaults to 0. cv_prediction (bool, optional): Whether to predict the mean prediction using the cv models or rather a single model. Defaults to False.