class_docstr: Mean Reciprocal Rank.
  
  References
  ----------
  https://en.wikipedia.org/wiki/Mean_reciprocal_rank
class_docstr_tok: ["Mean","Reciprocal","Rank",".","References","--","--","--","--","--","https",":","\/\/en.wikipedia.org\/wiki\/Mean_reciprocal_rank"]
docstr: Compute Mean Reciprocal Rank score.
  
  Parameters
  ----------
  gt_pos: Numpy array
      Vector of positive items.
  
  pd_rank: Numpy array
      Item ranking prediction.
  
  **kwargs: For compatibility
  
  Returns
  -------
  mrr: A scalar
      Mean Reciprocal Rank score.
docstr_tok: ["Compute","Mean","Reciprocal","Rank","score",".","Parameters","--","--","--","--","--","gt_pos",":","Numpy","array","Vector","of","positive","items",".","pd_rank",":","Numpy","array","Item","ranking","prediction",".","*","*","kwargs",":","For","compatibility","Returns","--","--","--","-","mrr",":","A","scalar","Mean","Reciprocal","Rank","score","."]
code: def compute(self, gt_pos, pd_rank, **kwargs):
      """Compute Mean Reciprocal Rank score.
  
      Parameters
      ----------
      gt_pos: Numpy array
          Vector of positive items.
  
      pd_rank: Numpy array
          Item ranking prediction.
  
      **kwargs: For compatibility
  
      Returns
      -------
      mrr: A scalar
          Mean Reciprocal Rank score.
  
      """
      matched_items = np.nonzero(np.in1d(pd_rank, gt_pos))[0]
  
      if len(matched_items) == 0:
          raise ValueError(
              "No matched between ground-truth items and recommendations"
          )
  
      mrr = np.divide(
          1, (matched_items[0] + 1)
      )  # +1 because indices start from 0 in python
      return mrr
  
imports: import numpy
  from scipy.stats import rankdata
label_desc: Use image node_id 2 for calling the MRR obj's underlying member method code with example usage: obj.compute(gt_pos, pd_rank) and returns: mrr