code: def precision_score(y_true, y_pred):
      """Precision metric.
  
      Only computes a batch-wise average of precision.
  
      Computes the precision, a metric for multi-label classification of
      how many selected items are relevant.
      """
      K = tf.keras.backend
      true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
      predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1)))
      precision = true_positives / (predicted_positives + K.epsilon())
      return precision
  
file_path: nlp-architect/nlp_architect/models/np_semantic_segmentation.py
imports: import tensorflow
label_desc: Use image node_id 1 for calling a global function with example usage: precision_score(y_true, y_pred) and returns: precision