code: def auc_yc(
      y_true: Union[List[int], np.ndarray],
      y_score: Union[List[float], np.ndarray],
      n_bins: int = 100,
      return_std_maximum: bool = False,
      return_curve: bool = False,
  ) -> Union[
      float,
      Tuple[float, Tuple[List[int], List[float]]],
      Tuple[float, float, float],
      Tuple[float, float, float, Tuple[List[int], List[float]]],
  ]:
      """Compute Area Under the Youden's Curve (YC AUC) from prediction scores.
  
      YC AUC represents the rate of the effective threshold range.
  
      If return_std_maximum is set to True, std and maximum values of the Youden's Curve are returned with the AUC.
  
      Note: If only one class is present in y_true, zeroes are returned for every entity.
      """
      y_true = np.array(y_true)
      y_score = np.array(y_score)
      thresholds = np.linspace(0, 1, n_bins + 1)
      assert len(y_true) == len(y_score)
      assert np.all(y_true >= 0) and np.all(y_true <= 1)
      if np.all(y_true == 0) or np.all(y_true == 1):
          if return_std_maximum and return_curve:
              return (
                  0.0,
                  0.0,
                  0.0,
                  (thresholds, np.zeros(len(thresholds))),
              )
          elif return_std_maximum:
              return 0.0, 0.0, 0.0
          elif return_curve:
              return 0.0, (thresholds, np.zeros(len(thresholds)))
          else:
              return 0.0
      mask_correct = y_true == 1
      count_correct = max(len(mask_correct.nonzero()[0]), 1)
      count_incorrect = max(len(y_true) - count_correct, 1)
      y_score_correct = y_score[mask_correct]
      y_score_incorrect = y_score[~mask_correct]
      yc = []
      for threshold in thresholds:
          tnr = (
              len((y_score_incorrect < threshold).nonzero()[0])
              / count_incorrect
          )
          fnr = (
              len((y_score_correct < threshold).nonzero()[0])
              / count_correct
          )
          yc.append(abs(tnr - fnr))
      yc = np.array(yc)
      if return_std_maximum and return_curve:
          return yc.mean(), yc.std(), yc.max(), (thresholds, yc)
      elif return_std_maximum:
          return yc.mean(), yc.std(), yc.max()
      elif return_curve:
          return yc.mean(), (thresholds, yc)
      else:
          return yc.mean()
  
file_path: NeMo/nemo/collections/asr/parts/utils/confidence_metrics.py
imports: import math
  import os
  from pathlib import Path
  from typing import List, Optional, Tuple, Union
  import matplotlib.pyplot
  import numpy
  from sklearn.metrics import PrecisionRecallDisplay, RocCurveDisplay, average_precision_score, log_loss, precision_recall_curve, roc_auc_score, roc_curve
label_desc: Use image node_id 6 for calling a global function with example usage: auc_yc(y_true, y_score, n_bins, return_std_maximum, return_curve) and returns: yc,  yc,  yc,  thresholds,  yc, int,  int,  int,  thresholds,  np, yc,  yc,  yc, int,  int,  int, yc,  thresholds,  yc, yc, int,  thresholds,  np, int