class_docstr: Binary precision score.
  
  Parameters
  ----------
  cm
      This parameter allows sharing the same confusion matrix between multiple metrics. Sharing
      a confusion matrix reduces the amount of storage and computation time.
  pos_val
      Value to treat as "positive".
  
  Examples
  --------
  
  >>> from river import metrics
  
  >>> y_true = [True, False, True, True, True]
  >>> y_pred = [True, True, False, True, True]
  
  >>> metric = metrics.Precision()
  
  >>> for yt, yp in zip(y_true, y_pred):
  ...     metric.update(yt, yp)
  ...     print(metric)
  Precision: 100.00%
  Precision: 50.00%
  Precision: 50.00%
  Precision: 66.67%
  Precision: 75.00%
class_docstr_tok: ["Binary","precision","score",".","Parameters","--","--","--","--","--","cm","This","parameter","allows","sharing","the","same","confusion","matrix","between","multiple","metrics",".","Sharing","a","confusion","matrix","reduces","the","amount","of","storage","and","computation","time",".","pos_val","Value","to","treat","as","``","positive","''",".","Examples","--","--","--","--",">",">",">","from","river","import","metrics",">",">",">","y_true","=","[","True",",","False",",","True",",","True",",","True","]",">",">",">","y_pred","=","[","True",",","True",",","False",",","True",",","True","]",">",">",">","metric","=","metrics.Precision","(",")",">",">",">","for","yt",",","yp","in","zip","(","y_true",",","y_pred",")",":","...","metric.update","(","yt",",","yp",")","...","print","(","metric",")","Precision",":","100.00","%","Precision",":","50.00","%","Precision",":","50.00","%","Precision",":","66.67","%","Precision",":","75.00","%"]
code: def get(self):
      tp = self.cm.true_positives(self.pos_val)
      fp = self.cm.false_positives(self.pos_val)
      try:
          return tp / (tp + fp)
      except ZeroDivisionError:
          return 0.0
  
file_path: river/river/metrics/precision.py
imports: from __future__ import annotations
  from river import metrics
label_desc: Use image node_id 1 for calling the Precision obj's underlying member method code with example usage: obj.get() and returns: unknown, int