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: Match the metric value to the `k` and put them in `dictionary` form.
  
  Args:
      metric(str): the name of calculated metric.
      value(numpy.ndarray): metrics for each user, including values from `metric@1` to `metric@max(self.topk)`.
  
  Returns:
      dict: metric values required in the configuration.
docstr_tok: ["Match","the","metric","value","to","the","`","k","`","and","put","them","in","`","dictionary","`","form",".","Args",":","metric","(","str",")",":","the","name","of","calculated","metric",".","value","(","numpy.ndarray",")",":","metrics","for","each","user",",","including","values","from","`","metric","@","1","`","to","`","metric","@","max","(","self.topk",")","`",".","Returns",":","dict",":","metric","values","required","in","the","configuration","."]
code: def topk_result(self, metric, value):
      """Match the metric value to the `k` and put them in `dictionary` form.
  
      Args:
          metric(str): the name of calculated metric.
          value(numpy.ndarray): metrics for each user, including values from `metric@1` to `metric@max(self.topk)`.
  
      Returns:
          dict: metric values required in the configuration.
      """
      metric_dict = {}
      avg_result = value.mean(axis=0)
      for k in self.topk:
          key = "{}@{}".format(metric, k)
          metric_dict[key] = round(
              avg_result[k - 1], self.decimal_place
          )
      return metric_dict
  
file_path: RecBole/recbole/evaluator/base_metric.py
imports: import torch
  from recbole.utils import EvaluatorType
label_desc: Use image node_id 3 for calling the TopkMetric obj's underlying member method code with example usage: obj.topk_result(metric, value) and returns: metric_dict