pitci.base.AbsoluteErrorConformalPredictor¶
-
class
pitci.base.AbsoluteErrorConformalPredictor(model)[source]¶ Bases:
pitci.base.ConformalPredictorConformal interval predictor for an underlying
Anymodel using non-scaled absolute error as the nonconformity measure.Class implements inductive conformal intervals where a calibration dataset is used to learn the information that is used when generating intervals for new instances.
The predictor outputs fixed width intervals for every new instance, there is no interval scaling implemented in this class.
- Parameters
model (
Any) – UnderlyingAnymodel to generate prediction intervals with.
-
__version__¶ The version of the
pitcipackage that generated the object.- Type
str
-
model¶ The underlying
Anymodel passed in initialising the object.- Type
Any
-
baseline_interval¶ The default or baseline conformal half interval width. Will be applied without modification to provide an interval for all new instances. Attribute is set when the
calibrate()method is run.- Type
float
-
alpha¶ The confidence level of the conformal intervals that will be produced. Attribute is set when the
calibrate()method is run.- Type
int or float
-
abstract
__init__(model)¶ Initialize self. See help(type(self)) for accurate signature.
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)¶ 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)¶ 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