# ConformalPredictor


A calibrated conformal predictor ready to produce intervals.


Usage

``` python
ConformalPredictor(
    model,
    calibration_scores,
    quantile,
    level,
    method,
    _models=None,
    _fold_preds=None,
    _fold_ids=None,
)
```


Created by [conformal_fit()](conformal_fit.md#whittaker.conformal_fit). Wraps a fitted [GAM](GAM.md#whittaker.GAM) (or, for `"cv+"`/`"jackknife+"`, an ensemble of fold/leave-one-out GAMs) together with the conformity scores from calibration, so that `predict()` on new data returns intervals with a finite-sample marginal coverage guarantee that does not rely on the GAM's error distribution being correctly specified -- only on the calibration and test data being exchangeable.


## Attributes


`model: GAM`  
The GAM used for point predictions: fit on the training split for `"split"`, or on the full data for `"cv+"`/`"jackknife+"` (in which case predictions are instead ensembled from the per-fold/per-observation models).

`calibration_scores: NDArray`  
Absolute residuals from the calibration step (calibration split, K-fold, or leave-one-out, depending on [method](CausalGAM.md#whittaker.CausalGAM.method)).

`quantile: float`  
The calibration quantile of `calibration_scores` used to set interval half-width (`"split"` only).

`level: float`  
Nominal coverage level.

`method: str`  
Conformal method: `"split"`, `"cv+"`, or `"jackknife+"`.


## Methods

| Name | Description |
|----|----|
| [predict()](#predict) | Produce conformal prediction intervals on new data. |

------------------------------------------------------------------------


### predict()


Produce conformal prediction intervals on new data.


Usage

``` python
predict(new_data)
```


Dispatches to the interval construction appropriate for `self.method`: simple `values +/- quantile` bands for `"split"`, or the min/max-based `"cv+"` and `"jackknife+"` constructions that combine every fold/leave-one-out model's prediction with every calibration residual.


#### Parameters


`new_data: InputData`  
Column-oriented covariate data.


#### Returns


`ConformalResult`
