code: def _dcg_sample_scores(
      y_true, y_score, k=None, log_base=2, ignore_ties=False
  ):
      """Compute Discounted Cumulative Gain.
  
      Sum the true scores ranked in the order induced by the predicted scores,
      after applying a logarithmic discount.
  
      This ranking metric yields a high value if true labels are ranked high by
      ``y_score``.
  
      Parameters
      ----------
      y_true : ndarray of shape (n_samples, n_labels)
          True targets of multilabel classification, or true scores of entities
          to be ranked.
  
      y_score : ndarray of shape (n_samples, n_labels)
          Target scores, can either be probability estimates, confidence values,
          or non-thresholded measure of decisions (as returned by
          "decision_function" on some classifiers).
  
      k : int, default=None
          Only consider the highest k scores in the ranking. If `None`, use all
          outputs.
  
      log_base : float, default=2
          Base of the logarithm used for the discount. A low value means a
          sharper discount (top results are more important).
  
      ignore_ties : bool, default=False
          Assume that there are no ties in y_score (which is likely to be the
          case if y_score is continuous) for efficiency gains.
  
      Returns
      -------
      discounted_cumulative_gain : ndarray of shape (n_samples,)
          The DCG score for each sample.
  
      See Also
      --------
      ndcg_score : The Discounted Cumulative Gain divided by the Ideal Discounted
          Cumulative Gain (the DCG obtained for a perfect ranking), in order to
          have a score between 0 and 1.
      """
      discount = 1 / (
          np.log(np.arange(y_true.shape[1]) + 2) / np.log(log_base)
      )
      if k is not None:
          discount[k:] = 0
      if ignore_ties:
          ranking = np.argsort(y_score)[:, ::-1]
          ranked = y_true[
              np.arange(ranking.shape[0])[:, np.newaxis], ranking
          ]
          cumulative_gains = discount.dot(ranked.T)
      else:
          discount_cumsum = np.cumsum(discount)
          cumulative_gains = [
              _tie_averaged_dcg(y_t, y_s, discount_cumsum)
              for y_t, y_s in zip(y_true, y_score)
          ]
          cumulative_gains = np.asarray(cumulative_gains)
      return cumulative_gains
  
imports: import warnings
  from functools import partial
  from numbers import Integral, Real
  import numpy
  from scipy.sparse import csr_matrix, issparse
  from scipy.stats import rankdata
  from ..exceptions import UndefinedMetricWarning
  from ..preprocessing import label_binarize
  from ..utils import assert_all_finite, check_array, check_consistent_length, column_or_1d
  from ..utils._encode import _encode, _unique
  from ..utils._param_validation import Interval, StrOptions, validate_params
  from ..utils.extmath import stable_cumsum
  from ..utils.fixes import trapezoid
  from ..utils.multiclass import type_of_target
  from ..utils.sparsefuncs import count_nonzero
  from ..utils.validation import _check_pos_label_consistency, _check_sample_weight
  from ._base import _average_binary_score, _average_multiclass_ovo_score
label_desc: Use image node_id 13 for calling a global function with example usage: _dcg_sample_scores(y_true, y_score, k, log_base, ignore_ties) and returns: cumulative_gains