probly.conformal_prediction.scores.cqr.common

Common functions for Conformalized Quantile Regression (CQR) scores.

Functions

register(cls, func)

Register a backend-specific implementation for CQR scores.

Classes

CQRScore(model)

Backend-agnostic Conformalized Quantile Regression (CQR) score.

class probly.conformal_prediction.scores.cqr.common.CQRScore(model)[source]

Bases: RegressionScore

Backend-agnostic Conformalized Quantile Regression (CQR) score.

This class wraps cqr_score_func() and a regression-style quantile predictor. The predictor is expected to output, for each input instance, a pair [q_lo, q_hi] representing lower and upper conditional quantiles.

Parameters:

model (Predictor)

calibration_nonconformity(x_cal, y_cal, y_pred=None)

Compute calibration scores.

Parameters:
  • x_cal (Sequence[Any])

  • y_cal (Sequence[Any])

  • y_pred (Any | None)

Return type:

npt.NDArray[np.floating]

compute_score(y_true, y_pred)[source]

Compute CQR nonconformity scores.

Parameters:
Return type:

ndarray[Any, dtype[floating]]

construct_intervals(y_hat, threshold)

Construct prediction intervals (Preserves backend).

Parameters:
Return type:

Any

predict_nonconformity(x_test)

For regression, return predictions for interval construction.

Parameters:

x_test (Sequence[Any])

Return type:

Any

probly.conformal_prediction.scores.cqr.common.register(cls, func)[source]

Register a backend-specific implementation for CQR scores.

Parameters:
  • cls (LazyType) – Lazy type identifying the array backend (e.g. JAX Array).

  • func (Callable[..., Any]) – Backend-specific implementation with the same signature as cqr_score_func().

Return type:

None