class_docstr: Precision-Recall Area under the curve.
  
  Args:
      num_classes (int): Number of classes
      n_bins (int): number of confidence threshold to evaluate on.
      average (bool): If true will return the mean AuC of all classes.
class_docstr_tok: ["Precision-Recall","Area","under","the","curve",".","Args",":","num_classes","(","int",")",":","Number","of","classes","n_bins","(","int",")",":","number","of","confidence","threshold","to","evaluate","on",".","average","(","bool",")",":","If","true","will","return","the","mean","AuC","of","all","classes","."]
code: def value(self):
      result = []
      for cls in range(self.num_classes):
          precisions = np.array(
              [
                  r.tp / max(1, r.tp + r.fp)
                  for r in self._data[cls].values()
              ]
          )
          recalls = np.array(
              [
                  r.tp / max(1, r.tp + r.fn)
                  for r in self._data[cls].values()
              ]
          )
          idx = np.argsort(recalls)
          precisions = precisions[idx]
          recalls = recalls[idx]
  
          result.append(auc(recalls, precisions))
      if self._average:
          return np.mean(result)
      return result
  
imports: import dataclasses
  import math
  import warnings
  from collections import defaultdict
  import numpy
  import torch
  from sklearn.metrics import confusion_matrix, auc
  from baal.utils.array_utils import to_prob
label_desc: Use image node_id 5 for calling the PRAuC obj's underlying member method code with example usage: obj.value() and returns: result, np