code: def calculate_score(model, true_edges, fake_edges):
      """Calculate the AUC score, F1 score and PR score of specified edge type"""
      true_list = list()
      prediction_list = list()
      true_num = 0
      for edge in true_edges:
          tmp_score = get_score(model, edge)
          if tmp_score is not None:
              true_list.append(1)
              prediction_list.append(tmp_score)
              true_num += 1
  
      for edge in fake_edges:
          tmp_score = get_score(model, edge)
          if tmp_score is not None:
              true_list.append(0)
              prediction_list.append(tmp_score)
  
      sorted_pred = prediction_list[:]
      sorted_pred.sort()
      threshold = sorted_pred[-true_num]
  
      y_pred = np.zeros(len(prediction_list), dtype=np.int32)
      for i in range(len(prediction_list)):
          if prediction_list[i] >= threshold:
              y_pred[i] = 1
  
      y_true = np.array(true_list)
      y_scores = np.array(prediction_list)
      ps, rs, _ = precision_recall_curve(y_true, y_scores)
      return (
          roc_auc_score(y_true, y_scores),
          f1_score(y_true, y_pred),
          auc(rs, ps),
      )
  
imports: import os
  import argparse
  import time
  import numpy
  import logging
  import pickle
  import pgl
  from pgl.utils import paddle_helper
  import paddle
  import paddle.fluid
  import paddle.fluid.layers
  from utils import *
  import Dataset
  import model
  from sklearn.metrics import auc, f1_score, precision_recall_curve, roc_auc_score
label_desc: Use image node_id 4 for calling a global function with example usage: calculate_score(model, true_edges, fake_edges) and returns: roc_auc_score,  f1_score,  auc