pitci.base.ConformalPredictor¶
-
class
pitci.base.ConformalPredictor(model)[source]¶ Bases:
abc.ABCBase class for all conformal predictors in the
pitcipackage.This class contains the generic methods that all child classes can inherit.
-
__version__¶ The version of the
pitcipackage that generated the object.- Type
str
-
model¶ The underlying model passed in initialising the object.
- Type
Any
Methods
__init__(model)Initialize self.
calibrate(data, response[, alpha])Calibrate conformal intervals that will be applied to new instances when calling
predict_with_interval.predict_with_interval(data)Generate predictions with conformal intervals using the underlying
model.-
calibrate(data, response, alpha=0.95)[source]¶ Calibrate conformal intervals that will be applied to new instances when calling
predict_with_interval.The value passed in
alphais stored in an attribute of the same name.- Parameters
data (
Any) – Dataset to calibrate baselines on.response (np.ndarray or pd.Series) – The associated response values for every record in
data.alpha (int or float, default = 0.95) – Confidence level for the intervals.
-
predict_with_interval(data)[source]¶ Generate predictions with conformal intervals using the underlying
model.- Parameters
data (
Any) – Dataset to generate predictions with intervals on.- Returns
predictions_with_interval – Array of predictions with intervals for each row in
data. Output array will have 3 columns where the first is the lower interval, second are the predictions and the third is the upper interval.- Return type
np.ndarray
-