code: def get_metrics_binary(
      y_true, y_pred, y_pred_probs, include_curves=False
  ):
      results = {
          Metrics.ACCURACY: accuracy_score(y_true, y_pred),
          Metrics.COHEN_KAPPA: cohen_kappa_score(y_true, y_pred),
          Metrics.F1: f1_score(y_true, y_pred),
          Metrics.MCC: matthews_corrcoef(y_true, y_pred),
          Metrics.ROC_AUC: np.nan,
          Metrics.AP: np.nan,
      }
  
      # if possible, compute PR and ROC curve metrics
      all_labels_same = len(np.unique(y_true)) == 1
      any_probs_nan = np.any(np.isnan(y_pred_probs))
      if not any_probs_nan:
          # AP can be computed even if all labels are the same
          y_true_bin = get_per_class_matrix(y_true, list(range(2)))
          results[Metrics.AP] = average_precision_score(
              y_true_bin, y_pred_probs
          )
  
          if not all_labels_same:
              results[Metrics.ROC_AUC] = roc_auc_score(
                  y_true_bin, y_pred_probs
              )
  
          # if necessary, compute point-by-point precision/recall and ROC curve data
          if include_curves:
              results.update(
                  get_pr_roc_curves(y_true, y_pred_probs[:, 1])
              )
  
      return results
  
file_path: ATM/atm/metrics.py
imports: from __future__ import absolute_import, division, unicode_literals
  from builtins import range
  import numpy
  import pandas
  from sklearn.metrics import accuracy_score, average_precision_score, cohen_kappa_score, f1_score, matthews_corrcoef, precision_recall_curve, roc_auc_score, roc_curve
  from sklearn.model_selection import StratifiedKFold
  from atm.constants import METRICS_BINARY, METRICS_MULTICLASS, N_FOLDS_DEFAULT, Metrics
label_desc: Use image node_id 4 for calling a global function with example usage: get_metrics_binary(y_true, y_pred, y_pred_probs, include_curves) and returns: results