class_docstr: :class:`TopkMetric` is a base object of top-k metrics. If you want to
  implement an top-k metric, you can inherit this class.
  
  Args:
      config (Config): The config of evaluator.
class_docstr_tok: [":","class",":","`","TopkMetric","`","is","a","base","object","of","top-k","metrics",".","If","you","want","to","implement","an","top-k","metric",",","you","can","inherit","this","class",".","Args",":","config","(","Config",")",":","The","config","of","evaluator","."]
docstr: Calculate the value of the metric.
  
  Args:
      pos_index(numpy.ndarray): a bool matrix, shape of ``n_users * max(topk)``. The item with the (j+1)-th             highest score of i-th user is positive if ``pos_index[i][j] == True`` and negative otherwise.
      pos_len(numpy.ndarray): a vector representing the number of positive items per user, shape of ``(n_users,)``.
  
  Returns:
      numpy.ndarray: metrics for each user, including values from `metric@1` to `metric@max(self.topk)`.
docstr_tok: ["Calculate","the","value","of","the","metric",".","Args",":","pos_index","(","numpy.ndarray",")",":","a","bool","matrix",",","shape","of","``","n_users","*","max","(","topk",")","``",".","The","item","with","the","(","j+1",")","-th","highest","score","of","i-th","user","is","positive","if","``","pos_index","[","i","]","[","j","]","==","True","``","and","negative","otherwise",".","pos_len","(","numpy.ndarray",")",":","a","vector","representing","the","number","of","positive","items","per","user",",","shape","of","``","(","n_users",",",")","``",".","Returns",":","numpy.ndarray",":","metrics","for","each","user",",","including","values","from","`","metric","@","1","`","to","`","metric","@","max","(","self.topk",")","`","."]
code: def metric_info(self, pos_index, pos_len=None):
      """Calculate the value of the metric.
  
          Args:
              pos_index(numpy.ndarray): a bool matrix, shape of ``n_users * max(topk)``. The item with the (j+1)-th \
              highest score of i-th user is positive if ``pos_index[i][j] == True`` and negative otherwise.
              pos_len(numpy.ndarray): a vector representing the number of positive items per user, shape of ``(n_users,)``.
  
          Returns:
              numpy.ndarray: metrics for each user, including values from `metric@1` to `metric@max(self.topk)`.
          """
      raise NotImplementedError(
          "Method [metric_info] of top-k metric should be implemented."
      )
  
file_path: RecBole/recbole/evaluator/base_metric.py
imports: import torch
  from recbole.utils import EvaluatorType
label_desc: Use image node_id 4 for calling the TopkMetric obj's underlying member method code with example usage: obj.metric_info(pos_index, pos_len) without return types