code: def _compute_tp_fn_fp(ps, ts):
      ps = ps.copy()
      tp = 0
      fp = 0
      fn = 0
      if isinstance(ts, (set, list, np.ndarray)):
          ts = {tuple(key): 1 for key in list(ts)}
      if isinstance(ps, (set, list, np.ndarray)):
          ps = {tuple(key): 1 for key in list(ps)}
  
      for key in ts.keys():
          t_num = ts[key]
          if key not in ps:
              p_num = 0
          else:
              p_num = ps[key]
          tp += min(p_num, t_num)
          fp += max(p_num - t_num, 0)
          fn += max(t_num - p_num, 0)
          if key in ps:
              ps.pop(key)
      fp += sum(ps.values())
      return tp, fn, fp
  
file_path: DeepKE/src/deepke/name_entity_re/few_shot/module/metrics.py
imports: import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: _compute_tp_fn_fp(ps, ts) and returns: tp,  fn,  fp