docstr: Adds precision recall curve.
  
  Args:
      tag (string): Data identifier
      labels (torch.Tensor, numpy.array, or string/blobname): Ground truth data. Binary label for each element.
      predictions (torch.Tensor, numpy.array, or string/blobname):
      The probability that an element be classified as true. Value should in [0, 1]
      global_step (int): Global step value to record
      num_thresholds (int): Number of thresholds used to draw the curve.
docstr_tok: ["Adds","precision","recall","curve",".","Args",":","tag","(","string",")",":","Data","identifier","labels","(","torch.Tensor",",","numpy.array",",","or","string\/blobname",")",":","Ground","truth","data",".","Binary","label","for","each","element",".","predictions","(","torch.Tensor",",","numpy.array",",","or","string\/blobname",")",":","The","probability","that","an","element","be","classified","as","true",".","Value","should","in","[","0",",","1","]","global_step","(","int",")",":","Global","step","value","to","record","num_thresholds","(","int",")",":","Number","of","thresholds","used","to","draw","the","curve","."]
code: def add_pr_curve(
      self,
      tag,
      labels,
      predictions,
      global_step=None,
      num_thresholds=127,
      weights=None,
  ):
      """Adds precision recall curve.
  
      Args:
          tag (string): Data identifier
          labels (torch.Tensor, numpy.array, or string/blobname): Ground truth data. Binary label for each element.
          predictions (torch.Tensor, numpy.array, or string/blobname):
          The probability that an element be classified as true. Value should in [0, 1]
          global_step (int): Global step value to record
          num_thresholds (int): Number of thresholds used to draw the curve.
  
      """
      labels, predictions = make_np(labels), make_np(predictions)
      raw_data = compute_curve(
          labels, predictions, num_thresholds, weights
      )
  
      # compute_curve returns np.stack((tp, fp, tn, fn, precision, recall))
      # We want to access 'precision' and 'recall'
      precision, recall = raw_data[4, :], raw_data[5, :]
  
      self.vis.line(
          X=recall,
          Y=precision,
          name=tag,
          opts={
              "title": "PR Curve for {}".format(tag),
              "xlabel": "recall",
              "ylabel": "precision",
          },
      )
  
imports: import gc
  import numpy
  import math
  import json
  import time
  from .summary import compute_curve
  from .utils import figure_to_image
  from .x2num import make_np
label_desc: Use image node_id 15 for calling the VisdomWriter obj's underlying member method code with example usage: obj.add_pr_curve(tag, labels, predictions, global_step, num_thresholds, weights) without return types