code: def _roc_curve(y_true, y_score):
      """Compute Receiver operating characteristic (ROC)
  
      Note: this implementation is restricted to the binary classification task.
  
      Parameters
      ----------
  
      y_true : array, shape = [n_samples]
          True binary labels. If labels are not either {-1, 1} or {0, 1}, then
          pos_label should be explicitly given.
  
      y_score : array, shape = [n_samples]
          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).
  
      Returns
      -------
      fpr : array, shape = [>2]
          Increasing false positive rates such that element i is the false
          positive rate of predictions with score >= thresholds[i].
  
      tpr : array, shape = [>2]
          Increasing true positive rates such that element i is the true
          positive rate of predictions with score >= thresholds[i].
  
      thresholds : array, shape = [n_thresholds]
          Decreasing thresholds on the decision function used to compute
          fpr and tpr. `thresholds[0]` represents no instances being predicted
          and is arbitrarily set to `max(y_score) + 1`.
  
      Notes
      -----
      Since the thresholds are sorted from low to high values, they
      are reversed upon returning them to ensure they correspond to both ``fpr``
      and ``tpr``, which are sorted in reversed order during their calculation.
  
      References
      ----------
      .. [1] `Wikipedia entry for the Receiver operating characteristic
              <https://en.wikipedia.org/wiki/Receiver_operating_characteristic>`_
  
      .. [2] Fawcett T. An introduction to ROC analysis[J]. Pattern Recognition
             Letters, 2006, 27(8):861-874.
      """
      fps, tps, thresholds = _binary_clf_curve(y_true, y_score)
  
      # Add an extra threshold position
      # to make sure that the curve starts at (0, 0)
      tps = np.r_[0, tps]
      fps = np.r_[0, fps]
      thresholds = np.r_[thresholds[0] + 1, thresholds]
  
      if fps[-1] <= 0:
          fpr = np.repeat(np.nan, fps.shape)
      else:
          fpr = fps / fps[-1]
  
      if tps[-1] <= 0:
          tpr = np.repeat(np.nan, tps.shape)
      else:
          tpr = tps / tps[-1]
  
      return fpr, tpr, thresholds
  
imports: from collections import defaultdict
  from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Optional, Set, Tuple
  import numpy
  from .errors import Errors
  from .morphology import Morphology
  from .tokens import Doc, Span, Token
  from .training import Example
  from .util import SimpleFrozenList, get_lang_class
label_desc: Use image node_id 4 for calling a global function with example usage: _roc_curve(y_true, y_score) and returns: fpr,  tpr,  thresholds