class_docstr: Aggregation function for multiple metrics.
class_docstr_tok: ["Aggregation","function","for","multiple","metrics","."]
docstr: Calculates multiple metrics including precision and recall.
  
  :param true_y: The true labels.
  :type true_y: numpy.ndarray
  :param pred_y: The predicted labels.
  :type pred_y: numpy.ndarray
  :returns: Multiple metrics as a tuple, including the
      aggregated metric, TP, FP, FN, TN for the confusion
      matrix and error count.
  :rtype: (int, list, list, list, list, int)
docstr_tok: ["Calculates","multiple","metrics","including","precision","and","recall",".",":","param","true_y",":","The","true","labels",".",":","type","true_y",":","numpy.ndarray",":","param","pred_y",":","The","predicted","labels",".",":","type","pred_y",":","numpy.ndarray",":","returns",":","Multiple","metrics","as","a","tuple",",","including","the","aggregated","metric",",","TP",",","FP",",","FN",",","TN","for","the","confusion","matrix","and","error","count",".",":","rtype",":","(","int",",","list",",","list",",","list",",","list",",","int",")"]
code: def _multi_metric_result(self, true_y, pred_y):
      """Calculates multiple metrics including precision and recall.
  
      :param true_y: The true labels.
      :type true_y: numpy.ndarray
      :param pred_y: The predicted labels.
      :type pred_y: numpy.ndarray
      :returns: Multiple metrics as a tuple, including the
          aggregated metric, TP, FP, FN, TN for the confusion
          matrix and error count.
      :rtype: (int, list, list, list, list, int)
      """
      pred_y = np.array(pred_y)
      true_y = np.array(true_y)
      conf_matrix = multilabel_confusion_matrix(
          true_y, pred_y, labels=self.labels
      )
      tp_sum = conf_matrix[:, 1, 1]
      diff = pred_y != true_y
      error = diff.sum()
      # needed for precision metrics
      fp_sum = conf_matrix[:, 0, 1]
      # needed for recall metrics
      fn_sum = conf_matrix[:, 1, 0]
      tn_sum = conf_matrix[:, 0, 0]
      if self.num_labels == 2 and self.metric != Metrics.ACCURACY_SCORE:
          metric_value = self.aggfunc(
              true_y, pred_y, pos_label=self.labels[0]
          )
      else:
          metric_value = self.aggfunc(true_y, pred_y)
      return (
          metric_value,
          tp_sum.tolist(),
          fp_sum.tolist(),
          fn_sum.tolist(),
          tn_sum.tolist(),
          error,
      )
  
imports: import logging
  import math
  import warnings
  from abc import ABC, abstractmethod
  import numpy
  import pandas
  from sklearn.metrics import multilabel_confusion_matrix
  from erroranalysis._internal.cohort_filter import filter_from_cohort
  from erroranalysis._internal.constants import DIFF, PRED_Y, ROW_INDEX, TRUE_Y, MatrixParams, MetricKeys, Metrics, ModelTask, metric_to_display_name
  from erroranalysis._internal.metrics import get_ordered_classes, is_multi_agg_metric, metric_to_func
  from raiutils.exceptions import UserConfigValidationException
label_desc: Use image node_id 2 for calling the _MultiMetricAggFunc obj's underlying member method code with example usage: obj._multi_metric_result(true_y, pred_y) and returns: metric_value,  tp_sum,  fp_sum,  fn_sum,  tn_sum,  error