code: def coverage_error(y_true, y_score, sample_weight=None):
      """Coverage error measure
  
      Compute how far we need to go through the ranked scores to cover all
      true labels. The best value is equal to the average number
      of labels in ``y_true`` per sample.
  
      Ties in ``y_scores`` are broken by giving maximal rank that would have
      been assigned to all tied values.
  
      Read more in the :ref:`User Guide <coverage_error>`.
  
      Parameters
      ----------
      y_true : array, shape = [n_samples, n_labels]
          True binary labels in binary indicator format.
  
      y_score : array, shape = [n_samples, n_labels]
          Target scores, can either be probability estimates of the positive
          class, confidence values, or non-thresholded measure of decisions
          (as returned by "decision_function" on some classifiers).
  
      sample_weight : array-like of shape = [n_samples], optional
          Sample weights.
  
      Returns
      -------
      coverage_error : float
  
      References
      ----------
      .. [1] Tsoumakas, G., Katakis, I., & Vlahavas, I. (2010).
             Mining multi-label data. In Data mining and knowledge discovery
             handbook (pp. 667-685). Springer US.
  
      """
      y_true = check_array(y_true, ensure_2d=False)
      y_score = check_array(y_score, ensure_2d=False)
      check_consistent_length(y_true, y_score, sample_weight)
  
      y_type = type_of_target(y_true)
      if y_type != "multilabel-indicator":
          raise ValueError("{0} format is not supported".format(y_type))
  
      if y_true.shape != y_score.shape:
          raise ValueError("y_true and y_score have different shape")
  
      y_score_mask = np.ma.masked_array(
          y_score, mask=np.logical_not(y_true)
      )
      y_min_relevant = y_score_mask.min(axis=1).reshape((-1, 1))
      coverage = (y_score >= y_min_relevant).sum(axis=1)
      coverage = coverage.filled(0)
  
      return np.average(coverage, weights=sample_weight)
  
imports: from __future__ import division
  import warnings
  import numpy
  from scipy.sparse import csr_matrix
  from ..utils import assert_all_finite
  from ..utils import check_consistent_length
  from ..utils import column_or_1d, check_array
  from ..utils.multiclass import type_of_target
  from ..utils.extmath import stable_cumsum
  from ..utils.fixes import bincount
  from ..utils.fixes import array_equal
  from ..utils.stats import rankdata
  from ..utils.sparsefuncs import count_nonzero
  from ..exceptions import UndefinedMetricWarning
  from .base import _average_binary_score
label_desc: Use image node_id 8 for calling a global function with example usage: coverage_error(y_true, y_score, sample_weight) and returns: np