code: def evaluate(gt_labels, pred_labels, metric="pairwise"):
      if isinstance(gt_labels, str) and isinstance(pred_labels, str):
          print("[gt_labels] {}".format(gt_labels))
          print("[pred_labels] {}".format(pred_labels))
          gt_labels, gt_lb_set = _read_meta(gt_labels)
          pred_labels, pred_lb_set = _read_meta(pred_labels)
  
          print(
              "#inst: gt({}) vs pred({})".format(
                  len(gt_labels), len(pred_labels)
              )
          )
          print(
              "#cls: gt({}) vs pred({})".format(
                  len(gt_lb_set), len(pred_lb_set)
              )
          )
  
      metric_func = metrics.__dict__[metric]
  
      with Timer(
          "evaluate with {}{}{}".format(
              TextColors.FATAL, metric, TextColors.ENDC
          )
      ):
          result = metric_func(gt_labels, pred_labels)
      if isinstance(result, np.float):
          print(
              "{}{}: {:.4f}{}".format(
                  TextColors.OKGREEN, metric, result, TextColors.ENDC
              )
          )
      else:
          ave_pre, ave_rec, fscore = result
          print(
              "{}ave_pre: {:.4f}, ave_rec: {:.4f}, fscore: {:.4f}{}".format(
                  TextColors.OKGREEN,
                  ave_pre,
                  ave_rec,
                  fscore,
                  TextColors.ENDC,
              )
          )
  
file_path: dgl/examples/pytorch/hilander/utils/evaluate.py
imports: import argparse
  import inspect
  import numpy
  from clustering_benchmark import ClusteringBenchmark
  from utils import metrics, TextColors, Timer
label_desc: Use image node_id 2 for calling a global function with example usage: evaluate(gt_labels, pred_labels, metric) without return types