class_docstr: Class for computing metrics based on a single
  :obj:`~aif360.datasets.RegressionDataset`.
docstr: Discounted Cumulative Gain metric.
  
  Args:
      r (int): position up to which to calculate the DCG. If not specified, is set to the size of the dataset.
      normalized (bool): return normalized DCG.
      
  Returns:
      The calculated DCG.
code: def discounted_cum_gain(
      self,
      r: int = None,
      full_dataset: RegressionDataset = None,
      normalized=False,
  ):
      """
      Discounted Cumulative Gain metric.
  
      Args:
          r (int): position up to which to calculate the DCG. If not specified, is set to the size of the dataset.
          normalized (bool): return normalized DCG.
  
      Returns:
          The calculated DCG.
      """
      if r is None:
          r = np.ravel(self.dataset.scores).shape[0]
      if r < 0:
          raise ValueError(f"r must be >= 0, got {r}")
      if normalized == True and full_dataset is None:
          raise ValueError(
              "`normalized` is set to True, but `full_dataset` is not specified"
          )
      if not isinstance(full_dataset, RegressionDataset) and not (
          full_dataset is None
      ):
          raise TypeError(
              f"`full_datset`: expected `RegressionDataset`, got {type(full_dataset)}"
          )
      scores = np.ravel(self.dataset.scores)[:r]
      z = self._dcg(scores)
      if normalized:
          z /= self._dcg(
              np.sort(np.ravel(full_dataset.scores))[::-1][:r]
          )
      return z
  
file_path: AIF360/aif360/metrics/regression_metric.py
imports: import numpy
  from aif360.metrics import DatasetMetric
  from aif360.datasets import RegressionDataset
label_desc: Use image node_id 3 for calling the RegressionDatasetMetric obj's underlying member method code with example usage: obj.discounted_cum_gain(r, full_dataset, normalized) and returns: z