docstr: compute Hits@K
  For each positive target node, the negative target nodes are the same.
  
  y_pred_neg is an array.
  rank y_pred_pos[i] against y_pred_neg for each i
docstr_tok: ["compute","Hits","@","K","For","each","positive","target","node",",","the","negative","target","nodes","are","the","same",".","y_pred_neg","is","an","array",".","rank","y_pred_pos","[","i","]","against","y_pred_neg","for","each","i"]
code: def _eval_hits(self, y_pred_pos, y_pred_neg, type_info):
      """
      compute Hits@K
      For each positive target node, the negative target nodes are the same.
  
      y_pred_neg is an array.
      rank y_pred_pos[i] against y_pred_neg for each i
      """
  
      if len(y_pred_neg) < self.K:
          return {"hits@{}".format(self.K): 1.0}
  
      if type_info == "torch":
          kth_score_in_negative_edges = torch.topk(y_pred_neg, self.K)[
              0
          ][-1]
          hitsK = float(
              torch.sum(y_pred_pos > kth_score_in_negative_edges).cpu()
          ) / len(y_pred_pos)
  
      # type_info is numpy
      else:
          kth_score_in_negative_edges = np.sort(y_pred_neg)[-self.K]
          hitsK = float(
              np.sum(y_pred_pos > kth_score_in_negative_edges)
          ) / len(y_pred_pos)
  
      return {"hits@{}".format(self.K): hitsK}
  
file_path: ogb/ogb/linkproppred/evaluate.py
imports: import os
  import numpy
  import pandas
  from sklearn.metrics import roc_auc_score
label_desc: Use image node_id 6 for calling the Evaluator obj's underlying member method code with example usage: obj._eval_hits(y_pred_pos, y_pred_neg, type_info) and returns: dict, dict