code: def get_roc_score(adj_rec, adj_orig, edges_pos, edges_neg):
      def sigmoid(x):
          return 1 / (1 + np.exp(-x))
  
      # Predict on test set of edges
  
      preds = []
      pos = []
      for e in edges_pos:
          preds.append(sigmoid(adj_rec[e[0], e[1]]))
          pos.append(adj_orig[e[0], e[1]])
      preds_neg = []
      neg = []
      for e in edges_neg:
          preds_neg.append(sigmoid(adj_rec[e[0], e[1]]))
          neg.append(adj_orig[e[0], e[1]])
      preds_all = np.hstack([preds, preds_neg])
      labels_all = np.hstack(
          [np.ones(len(preds)), np.zeros(len(preds_neg))]
      )
      roc_score = roc_auc_score(labels_all, preds_all)
      ap_score = average_precision_score(labels_all, preds_all)
      return roc_score, ap_score
  
file_path: graph4nlp/graph4nlp/pytorch/test/link_prediction/utils.py
imports: import pickle
  import networkx
  import numpy
  import scipy.sparse
  import torch
  from sklearn.metrics import average_precision_score, roc_auc_score
label_desc: Use image node_id 7 for calling a global function with example usage: get_roc_score(adj_rec, adj_orig, edges_pos, edges_neg) and returns: roc_score,  ap_score, unknown