lazyslide.metrics.segmentation.specificity

Contents

lazyslide.metrics.segmentation.specificity#

specificity(stats)#

Compute specificity (true negative rate) from segmentation statistics.

Specificity measures the proportion of actual negative instances that were correctly identified as negative. It represents the ability of the model to correctly identify negative cases and avoid false positives.

Parameters:
statsSegmentationStats

Segmentation statistics containing true negatives (tn) and false positives (fp).

Returns:
float

Specificity score in the range [0, 1], where 1 indicates perfect specificity. A small epsilon (1e-8) is added to the denominator to avoid division by zero.

Notes

Specificity = TN / (TN + FP) Also known as true negative rate (TNR). Specificity is the complement of the false positive rate: Specificity = 1 - FPR.