class_docstr: Creates a criterion that measures the Precision between the
  ground truth (gt) and the prediction (pr).
  
  .. math:: F_\beta(tp, fp) = \frac{tp} {(tp + fp)}
  
  where:
       - tp - true positives;
       - fp - false positives;
  
  Args:
      class_weights: 1. or ``np.array`` of class weights (``len(weights) = num_classes``).
      class_indexes: Optional integer or list of integers, classes to consider, if ``None`` all classes are used.
      smooth: Float value to avoid division by zero.
      per_image: If ``True``, metric is calculated as mean over images in batch (B),
          else over whole batch.
      threshold: Float value to round predictions (use ``>`` comparison), if ``None`` prediction will not be round.
      name: Optional string, if ``None`` default ``precision`` name is used.
  
  Returns:
      A callable ``precision`` instance. Can be used in ``model.compile(...)`` function.
  
  Example:
  
  .. code:: python
  
      metric = Precision()
      model.compile('SGD', loss=loss, metrics=[metric])
class_docstr_tok: ["Creates","a","criterion","that","measures","the","Precision","between","the","ground","truth","(","gt",")","and","the","prediction","(","pr",")",".","..","math",":",":","F_\\beta","(","tp",",","fp",")","=","\\frac","{","tp","}","{","(","tp","+","fp",")","}","where",":","-","tp","-","true","positives",";","-","fp","-","false","positives",";","Args",":","class_weights",":","1.","or","``","np.array","``","of","class","weights","(","``","len","(","weights",")","=","num_classes","``",")",".","class_indexes",":","Optional","integer","or","list","of","integers",",","classes","to","consider",",","if","``","None","``","all","classes","are","used",".","smooth",":","Float","value","to","avoid","division","by","zero",".","per_image",":","If","``","True","``",",","metric","is","calculated","as","mean","over","images","in","batch","(","B",")",",","else","over","whole","batch",".","threshold",":","Float","value","to","round","predictions","(","use","``",">","``","comparison",")",",","if","``","None","``","prediction","will","not","be","round",".","name",":","Optional","string",",","if","``","None","``","default","``","precision","``","name","is","used",".","Returns",":","A","callable","``","precision","``","instance",".","Can","be","used","in","``","model.compile","(","...",")","``","function",".","Example",":","..","code",":",":","python","metric","=","Precision","(",")","model.compile","(","'SGD","'",",","loss=loss",",","metrics=","[","metric","]",")"]
code: def __init__(
      self,
      class_weights=None,
      class_indexes=None,
      threshold=None,
      per_image=False,
      smooth=SMOOTH,
      name=None,
  ):
      name = name or "precision"
      super().__init__(name=name)
      self.class_weights = (
          class_weights if class_weights is not None else 1
      )
      self.class_indexes = class_indexes
      self.threshold = threshold
      self.per_image = per_image
      self.smooth = smooth
  
file_path: segmentation_models/segmentation_models/metrics.py
imports: from .base import Metric
  from .base import functional
label_desc: Use image node_id 1 to create a new Precision object from inherited base classes: Metric with example: obj = Precision(class_weights, class_indexes, threshold, per_image, smooth, name)