code: def _get_fbeta_score(true_positives, selected, relevant, beta=1):
      """Compute Fbeta score.
  
      Args:
        true_positives: Number of true positive ngrams.
        selected: Number of selected ngrams.
        relevant: Number of relevant ngrams.
        beta: 0 gives precision only, 1 gives F1 score, and Inf gives recall only.
  
      Returns:
        Fbeta score.
      """
      precision = 1
      if selected > 0:
          precision = true_positives / selected
      if beta == 0:
          return precision
      recall = 1
      if relevant > 0:
          recall = true_positives / relevant
      if precision > 0 and recall > 0:
          beta2 = beta * beta
          return (
              (1 + beta2)
              * precision
              * recall
              / (beta2 * precision + recall)
          )
      else:
          return 0
  
file_path: tensor2tensor/tensor2tensor/utils/sari_hook.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 2 for calling a global function with example usage: _get_fbeta_score(true_positives, selected, relevant, beta) and returns: precision, unknown, int