code: def _partial_roc_auc_score(y_true, y_predict, max_fpr):
      """Alternative implementation to check for correctness of `roc_auc_score`
      with `max_fpr` set.
      """
  
      def _partial_roc(y_true, y_predict, max_fpr):
          fpr, tpr, _ = sklearn_roc_curve(y_true, y_predict)
          new_fpr = fpr[fpr <= max_fpr]
          new_fpr = np.append(new_fpr, max_fpr)
          new_tpr = tpr[fpr <= max_fpr]
          idx_out = np.argmax(fpr > max_fpr)
          idx_in = idx_out - 1
          x_interp = [fpr[idx_in], fpr[idx_out]]
          y_interp = [tpr[idx_in], tpr[idx_out]]
          new_tpr = np.append(
              new_tpr, np.interp(max_fpr, x_interp, y_interp)
          )
          return (new_fpr, new_tpr)
  
      new_fpr, new_tpr = _partial_roc(y_true, y_predict, max_fpr)
      partial_auc = sklearn_auc(new_fpr, new_tpr)
  
      # Formula (5) from McClish 1989
      fpr1 = 0
      fpr2 = max_fpr
      min_area = 0.5 * (fpr2 - fpr1) * (fpr2 + fpr1)
      max_area = fpr2 - fpr1
      return 0.5 * (
          1 + (partial_auc - min_area) / (max_area - min_area)
      )
  
imports: import re
  import warnings
  import numpy
  import pandas
  import pytest
  from sklearn.metrics import roc_curve, auc, accuracy_score
  from sklearn.metrics.tests.test_ranking import make_prediction, _auc
  from sklearn.exceptions import UndefinedMetricWarning
  from sklearn.utils import check_random_state
  from sklearn.utils._testing import assert_almost_equal, assert_array_almost_equal
  from ....None import dataframe
  from ....None import tensor
  from ...utils.extmath import softmax
  from ..None import roc_curve, auc, accuracy_score, roc_auc_score
label_desc: Use image node_id 1 for calling a global function with example usage: _partial_roc_auc_score(y_true, y_predict, max_fpr) and returns: unknown, new_fpr,  new_tpr