ConformalClsAPS#
- class torch_uncertainty.post_processing.ConformalClsAPS(alpha, model=None, randomized=True, ts_init_val=1, ts_lr=0.1, ts_max_iter=100, enable_ts=True, device=None)[source]#
Conformal prediction with APS scores.
- Parameters:
alpha (
float) – The confidence level meaning we allow \(1-\alpha\) error.model (
Module|None) – Trained classification model. Defaults toNone.randomized (
bool) – Whether to use randomized smoothing in APS. Defaults toTrue.ts_init_val (
float) – Initial value for the temperature. Defaults to1.0.ts_lr (
float) – Learning rate for the temperature scaling optimizer. Defaults to0.1.ts_max_iter (
int) – Maximum number of iterations for the temperature scaling optimizer. Defaults to100.enable_ts (
bool) – Whether to scale the logits. Defaults toFalse.device (
Union[Literal['cpu','cuda'],device,None]) – device. Defaults toNone.
Warning
This implementation only works in the multiclass setting. Raise an issue if binary is needed.
- Reference:
TODO:
Code inspired by TorchCP.