code: def fowlkes_mallows_score(gt_labels, pred_labels, sparse=True):
      """The original function is from `sklearn.metrics.fowlkes_mallows_score`.
      We output the pairwise precision, pairwise recall and F-measure,
      instead of calculating the geometry mean of precision and recall.
      """
      (n_samples,) = gt_labels.shape
  
      c = contingency_matrix(gt_labels, pred_labels, sparse=sparse)
      tk = np.dot(c.data, c.data) - n_samples
      pk = np.sum(np.asarray(c.sum(axis=0)).ravel() ** 2) - n_samples
      qk = np.sum(np.asarray(c.sum(axis=1)).ravel() ** 2) - n_samples
  
      avg_pre = tk / pk
      avg_rec = tk / qk
      fscore = _compute_fscore(avg_pre, avg_rec)
  
      return avg_pre, avg_rec, fscore
  
file_path: dgl/examples/pytorch/hilander/utils/metrics.py
imports: from __future__ import division
  import numpy
  from sklearn.metrics import precision_score, recall_score
  from sklearn.metrics.cluster import contingency_matrix, normalized_mutual_info_score
label_desc: Use image node_id 4 for calling a global function with example usage: fowlkes_mallows_score(gt_labels, pred_labels, sparse) and returns: avg_pre,  avg_rec,  fscore