incerto.ood.detection_accuracy

incerto.ood.detection_accuracy#

incerto.ood.detection_accuracy(id_scores, ood_scores, id_accept_rate=0.95)[source]#

Compute detection accuracy at a given ID acceptance-rate threshold.

The threshold is set at the id_accept_rate-th percentile of the ID scores, so that approximately id_accept_rate fraction of in-distribution samples are correctly classified as ID.

Parameters:
  • id_scores – Scores for in-distribution samples (lower = more ID-like).

  • ood_scores – Scores for out-of-distribution samples (higher = more OOD-like).

  • id_accept_rate – Fraction of ID samples to accept (default: 0.95).

Returns:

Detection accuracy (fraction of correctly classified samples).