mapie.conformity_scores.AbsoluteConformityScore

class mapie.conformity_scores.AbsoluteConformityScore(sym: bool = True)[source]

Absolute conformity score.

The signed conformity score = y - y_pred. The conformity score is symmetrical.

This is appropriate when the confidence interval is symmetrical and its range is approximatively the same over the range of predicted values.

References

[1] Lei, J., G’Sell, M., Rinaldo, A., Tibshirani, R. J. & Wasserman, L.. “Distribution-Free Predictive Inference for Regression.” Journal of the American Statistical Association 2018.

__init__(sym: bool = True) None[source]
get_estimation_distribution(y_pred: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], conformity_scores: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], **kwargs) ndarray[tuple[Any, ...], dtype[_ScalarT]][source]

Compute samples of the estimation distribution from the predicted values and the conformity scores, from the following formula: signed conformity score = y - y_pred <=> y = y_pred + signed conformity score

conformity_scores can be either the conformity scores or the quantile of the conformity scores.

get_signed_conformity_scores(y: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], y_pred: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], **kwargs) ndarray[tuple[Any, ...], dtype[_ScalarT]][source]

Compute the signed conformity scores from the predicted values and the observed ones, from the following formula: signed conformity score = y - y_pred

Examples using mapie.conformity_scores.AbsoluteConformityScore

Conformal Predictive Distribution with MAPIE

Conformal Predictive Distribution with MAPIE

Coverage validity of MAPIE for regression tasks

Coverage validity of MAPIE for regression tasks

Adaptive conformal predictions for time series, Zaffran et al. (2022)

Adaptive conformal predictions for time series, Zaffran et al. (2022)