Binary Precision-Recall Curve#
- class anomalib.metrics.BinaryPrecisionRecallCurve(thresholds=None, ignore_index=None, validate_args=True, normalization='sigmoid', **kwargs)#
Bases:
BinaryPrecisionRecallCurveBinary precision-recall curve without threshold prediction normalization.
This class extends the torchmetrics
BinaryPrecisionRecallCurveclass but removes the sigmoid normalization step applied to prediction thresholds.Example
>>> import torch >>> from anomalib.metrics import BinaryPrecisionRecallCurve >>> metric = BinaryPrecisionRecallCurve() >>> preds = torch.tensor([0.1, 0.4, 0.35, 0.8]) >>> target = torch.tensor([0, 0, 1, 1]) >>> metric.update(preds, target) >>> precision, recall, thresholds = metric.compute()
- update(preds, target)#
Update metric state with new predictions and targets.
Unlike the base class, this method accepts raw predictions without applying sigmoid normalization.
- Parameters:
preds (
Tensor) – Raw predicted scores or probabilitiestarget (
Tensor) – Ground truth binary labels (0 or 1)
- Return type:
None