:py:mod:`anomalib.utils.metrics.aupr` ===================================== .. py:module:: anomalib.utils.metrics.aupr .. autoapi-nested-parse:: Implementation of AUROC metric based on TorchMetrics. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: anomalib.utils.metrics.aupr.AUPR .. py:class:: AUPR Bases: :py:obj:`torchmetrics.PrecisionRecallCurve` Area under the PR curve. .. py:method:: compute() -> torch.Tensor First compute PR curve, then compute area under the curve. :returns: Value of the AUPR metric .. py:method:: update(preds: torch.Tensor, target: torch.Tensor) -> None Update state with new values. Need to flatten new values as PrecicionRecallCurve expects them in this format for binary classification. :param preds: predictions of the model :type preds: Tensor :param target: ground truth targets :type target: Tensor .. py:method:: _compute() -> Tuple[torch.Tensor, torch.Tensor] Compute prec/rec value pairs. :returns: Tuple containing Tensors for rec and prec .. py:method:: generate_figure() -> Tuple[matplotlib.figure.Figure, str] Generate a figure containing the PR curve as well as the random baseline and the AUC. :returns: Tuple containing both the PR curve and the figure title to be used for logging :rtype: Tuple[Figure, str]