code: def calc_f1(y_true, y_pred, multilabel):
      if multilabel:
          y_pred[y_pred > 0] = 1
          y_pred[y_pred <= 0] = 0
      else:
          y_pred = np.argmax(y_pred, axis=1)
      return f1_score(y_true, y_pred, average="micro"), f1_score(
          y_true, y_pred, average="macro"
      )
  
file_path: dgl/examples/pytorch/graphsaint/utils.py
imports: import json
  import os
  from functools import namedtuple
  import dgl
  import numpy
  import scipy.sparse
  import torch
  from sklearn.metrics import f1_score
  from sklearn.preprocessing import StandardScaler
label_desc: Use image node_id 2 for calling a global function with example usage: calc_f1(y_true, y_pred, multilabel) and returns: f1_score,  f1_score