class_docstr: Measure at K.
  
  Attributes
  ----------
  k: int or list, optional, default: -1 (all)
      The number of items in the top@k list.
      If None, all items will be considered.
class_docstr_tok: ["Measure","at","K.","Attributes","--","--","--","--","--","k",":","int","or","list",",","optional",",","default",":","-1","(","all",")","The","number","of","items","in","the","top","@","k","list",".","If","None",",","all","items","will","be","considered","."]
docstr: Compute TP, TP+FN, and TP+FP.
  
  Parameters
  ----------
  gt_pos: Numpy array
      Vector of positive items.
  
  pd_rank: Numpy array
      Item ranking prediction.
  
  **kwargs: For compatibility
  
  Returns
  -------
  tp: A scalar
      True positive.
  
  tp_fn: A scalar
      True positive + false negative.
  
  tp_fp: A scalar
      True positive + false positive.
docstr_tok: ["Compute","TP",",","TP+FN",",","and","TP+FP",".","Parameters","--","--","--","--","--","gt_pos",":","Numpy","array","Vector","of","positive","items",".","pd_rank",":","Numpy","array","Item","ranking","prediction",".","*","*","kwargs",":","For","compatibility","Returns","--","--","--","-","tp",":","A","scalar","True","positive",".","tp_fn",":","A","scalar","True","positive","+","false","negative",".","tp_fp",":","A","scalar","True","positive","+","false","positive","."]
code: def compute(self, gt_pos, pd_rank, **kwargs):
      """Compute TP, TP+FN, and TP+FP.
  
      Parameters
      ----------
      gt_pos: Numpy array
          Vector of positive items.
  
      pd_rank: Numpy array
          Item ranking prediction.
  
      **kwargs: For compatibility
  
      Returns
      -------
      tp: A scalar
          True positive.
  
      tp_fn: A scalar
          True positive + false negative.
  
      tp_fp: A scalar
          True positive + false positive.
  
      """
      if self.k > 0:
          truncated_pd_rank = pd_rank[: self.k]
      else:
          truncated_pd_rank = pd_rank
  
      tp = np.sum(np.in1d(truncated_pd_rank, gt_pos))
      tp_fn = len(gt_pos)
      tp_fp = self.k if self.k > 0 else len(truncated_pd_rank)
  
      return tp, tp_fn, tp_fp
  
imports: import numpy
  from scipy.stats import rankdata
label_desc: Use image node_id 2 for calling the MeasureAtK obj's underlying member method code with example usage: obj.compute(gt_pos, pd_rank) and returns: tp,  tp_fn,  tp_fp