probly.conformal_prediction.scores.lac.common¶
Common functions for LAC Nonconformity-Scores.
Functions
|
Implements Accretive Completion to eliminate empty prediction sets (Null Regions). |
|
Register a class which can be used for LAC score computation. |
Classes
|
LAC Nonconformity-Score. |
- class probly.conformal_prediction.scores.lac.common.LACScore(model)[source]¶
Bases:
ClassificationScoreLAC Nonconformity-Score.
- Parameters:
model (Predictor)
- calibration_nonconformity(x_cal, y_cal, probs=None)¶
Compute calibration scores (vectorized, backend-agnostic).
- Parameters:
x_cal (Sequence[Any])
y_cal (Sequence[Any])
probs (Any | None)
- Return type:
npt.NDArray[np.floating]
- predict_nonconformity(x_test, probs=None)¶
Compute scores for all labels (stays on original device).
- Parameters:
x_test (Sequence[Any])
probs (Any | None)
- Return type:
Any
- probly.conformal_prediction.scores.lac.common.accretive_completion(prediction_sets, probs)[source]¶
Implements Accretive Completion to eliminate empty prediction sets (Null Regions).
- Parameters:
prediction_sets (np.ndarray) – Boolean array of shape (n_samples, n_classes). True indicates the class is in the set.
probs (np.ndarray) – Array of shape (n_samples, n_classes). Usually conditional probabilities p(y|x). High score implies higher likelihood of the class.
- Returns:
The modified prediction sets where every row has at least one True.
- Return type:
np.ndarray