class_docstr: Evaluate for trained models.
docstr: :param results: the scores of test examples.
  :param training_triple_pool: existing edges.
  :return: the ranks.
docstr_tok: [":","param","results",":","the","scores","of","test","examples",".",":","param","training_triple_pool",":","existing","edges",".",":","return",":","the","ranks","."]
code: def rank_extract(results, training_triple_pool):
      """
      :param results: the scores of test examples.
      :param training_triple_pool: existing edges.
      :return: the ranks.
      """
      eval_triple, head_score, tail_score = results
      head_order = np.argsort(head_score)
      tail_order = np.argsort(tail_score)
      head, relation, tail = (
          eval_triple[0],
          eval_triple[1],
          eval_triple[2],
      )
      head_rank_raw = 1
      tail_rank_raw = 1
      head_rank_filter = 1
      tail_rank_filter = 1
      for candidate in head_order:
          if candidate == head:
              break
          else:
              head_rank_raw += 1
              if (candidate, relation, tail) in training_triple_pool:
                  continue
              else:
                  head_rank_filter += 1
      for candidate in tail_order:
          if candidate == tail:
              break
          else:
              tail_rank_raw += 1
              if (head, relation, candidate) in training_triple_pool:
                  continue
              else:
                  tail_rank_filter += 1
      return (
          head_rank_raw,
          tail_rank_raw,
          head_rank_filter,
          tail_rank_filter,
      )
  
file_path: PGL/legacy/examples/pgl-ke/evalutate.py
imports: import numpy
  import timeit
  from mp_mapper import mp_reader_mapper
  from pgl.utils.logger import log
label_desc: Use image node_id 2 for calling the Evaluate obj's underlying member method code with example usage: obj.rank_extract(results, training_triple_pool) and returns: head_rank_raw,  tail_rank_raw,  head_rank_filter,  tail_rank_filter