code: def _get_tp_fp_for_thresholds(
      pos_scores: np.ndarray,
      neg_scores: np.ndarray,
      thresholds: Optional[np.ndarray] = None,
  ):
      """Gets all the tp and fp for a given array of thresholds.
  
      Args:
        pos_scores: per-example scores for the positive class.
        neg_scores: per-example scores for the negative class.
        thresholds: an array of thresholds to consider. Will consider elements
          **above** as positive. If not provided, will enumerate through all
          possible thresholds.
  
      Returns:
        A tuple as the true positives and false positives.
      """
      if thresholds is None:
          # pylint:disable=protected-access
          fp, tp, _ = sklearn.metrics._ranking._binary_clf_curve(
              y_true=np.concatenate(
                  [
                      np.ones_like(pos_scores, dtype=int),
                      np.zeros_like(neg_scores, dtype=int),
                  ]
              ),
              y_score=np.concatenate([pos_scores, neg_scores]),
          )
          return tp, fp
  
      def get_cum_sum(scores, thresholds):
          values = np.concatenate([scores, thresholds])
          indicators = np.concatenate(
              [
                  np.ones_like(scores, dtype=int),
                  np.zeros_like(thresholds, dtype=int),
              ]
          )
          sort_idx = np.argsort(values)[::-1]  # Descending
          indicators = indicators[sort_idx]
          return np.cumsum(indicators)[indicators == 0]
  
      tp = get_cum_sum(pos_scores, thresholds)
      fp = get_cum_sum(neg_scores, thresholds)
      return tp, fp
  
imports: import enum
  import numbers
  from typing import Dict, Iterable, Optional, Sequence, Union
  import immutabledict
  import numpy
  import numpy.typing
  import scipy.integrate
  import scipy.optimize
  import scipy.stats
  import sklearn.metrics
  from statsmodels.stats import proportion
label_desc: Use image node_id 1 for calling a global function with example usage: _get_tp_fp_for_thresholds(pos_scores, neg_scores, thresholds) and returns: tp,  fp, tp,  fp, np