docstr: compute and return ranking scores.
  
  Parameters
  ----------
  metrics:
      user provided metrics
  k:
      the cutoff value for NDCG, MAP, Recall, MRR, and Precision
  
  Returns
  -------
  Computed score.
docstr_tok: ["compute","and","return","ranking","scores",".","Parameters","--","--","--","--","--","metrics",":","user","provided","metrics","k",":","the","cutoff","value","for","NDCG",",","MAP",",","Recall",",","MRR",",","and","Precision","Returns","--","--","--","-","Computed","score","."]
code: def compute(
      self, metrics: Union[str, list] = None, k: Optional[int] = 10
  ):
      """
      compute and return ranking scores.
  
      Parameters
      ----------
      metrics:
          user provided metrics
      k:
          the cutoff value for NDCG, MAP, Recall, MRR, and Precision
  
      Returns
      -------
      Computed score.
  
      """
      if isinstance(metrics, str):
          metrics = [metrics]
      if not metrics:  # no metric is provided
          metrics = self.supported_metrics.keys()
  
      return_res = {}
  
      eval_res = np.mean(
          [
              list(self._compute_one(idx, k))
              for idx in self.results.keys()
          ],
          axis=0,
      )
  
      for metric in metrics:
          metric = metric.lower()
          if metric in self.supported_metrics:
              return_res.update(
                  {
                      f"{metric}@{k}": eval_res[
                          self.supported_metrics[metric]
                      ]
                  }
              )
  
      return return_res
  
imports: import logging
  import math
  import operator
  import warnings
  from typing import Dict, List, Optional, Tuple, Union
  import evaluate
  import numpy
  from sklearn.metrics import f1_score
  from autogluon.core.metrics import Scorer, get_metric
  from ..constants import ACCURACY, AVERAGE_PRECISION, BINARY, DIRECT_LOSS, F1, FEW_SHOT_CLASSIFICATION, IOU, MAP, MATCHING_METRICS, MATCHING_METRICS_WITHOUT_PROBLEM_TYPE, MAX, METRIC_MODE_MAP, MIN, MULTICLASS, NDCG, NER, NER_TOKEN_F1, NUMERICAL, OBJECT_DETECTION, OPEN_VOCABULARY_OBJECT_DETECTION, OVERALL_ACCURACY, OVERALL_F1, PRECISION, RECALL, REGRESSION, RETRIEVAL_METRICS, RMSE, ROC_AUC, SEMANTIC_SEGMENTATION, SPEARMANR, Y_PRED, Y_PRED_PROB, Y_TRUE
  from ..problem_types import PROBLEM_TYPES_REG
label_desc: Use image node_id 2 for calling the RankingMetrics obj's underlying member method code with example usage: obj.compute(metrics, k) and returns: return_res