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 (nn.Module) – Trained classification model. Defaults to
None.randomized (bool) – Whether to use randomized smoothing in APS. Defaults to
True.ts_init_val (float, optional) – Initial value for the temperature. Defaults to
1.0.ts_lr (float, optional) – Learning rate for the optimizer. Defaults to
0.1.ts_max_iter (int, optional) – Maximum number of iterations for the optimizer. Defaults to
100.enable_ts (bool) – Whether to scale the logits. Defaults to
False.device (Literal["cpu", "cuda"] | torch.device | None, optional) – device. Defaults to
None.
- Reference:
TODO:
Code inspired by TorchCP.