code: def fbeta(
      y_pred: Tensor,
      y_true: Tensor,
      thresh: float = 0.3,
      beta: float = 2,
      eps: float = 1e-9,
      sigmoid: bool = True,
      **kwargs,
  ):
      "Computes the f_beta between `preds` and `targets`"
      beta2 = beta**2
      if sigmoid:
          y_pred = y_pred.sigmoid()
      y_pred = (y_pred > thresh).float()
      y_true = y_true.float()
      TP = (y_pred * y_true).sum(dim=1)
      prec = TP / (y_pred.sum(dim=1) + eps)
      rec = TP / (y_true.sum(dim=1) + eps)
      res = (prec * rec) / (prec * beta2 + rec + eps) * (1 + beta2)
      return res.mean().item()
  
file_path: fast-bert/fast_bert/metrics.py
imports: import numpy
  from torch import Tensor
  from sklearn.metrics import roc_curve, auc, hamming_loss, accuracy_score, confusion_matrix
  import pdb
  import logging
label_desc: Use image node_id 4 for calling a global function with example usage: fbeta(y_pred, y_true, thresh, beta, eps, sigmoid) and returns: res