class_docstr: Calculate confusion matrix metrics for each subgroup
  
  Parameters
  -----------
  sub_confusion_matrix : SubgroupConfusionMatrix
      Object with calculated confusion matrix values for each subgroup
  
  Attributes
  -----------
  subgroup_confusion_matrix_metrics : dict
      Dictionary with confusion matrix metrics for each subgroup
code: def __init__(self, sub_confusion_matrix):
      assert isinstance(sub_confusion_matrix, SubgroupConfusionMatrix)
  
      matrix_dict = sub_confusion_matrix.sub_dict
      subgroup_confusion_matrix_metrics = {}
  
      for sub, cm in matrix_dict.items():
          tp, tn, fp, fn = cm.tp, cm.tn, cm.fp, cm.fn
  
          TPR = (
              TNR
          ) = PPV = NPV = FNR = FPR = FDR = FOR = ACC = STP = np.nan
  
          if tp + fn > 0:
              TPR = tp / (tp + fn)
              FNR = fn / (tp + fn)
          if tn + fp > 0:
              TNR = tn / (tn + fp)
              FPR = fp / (fp + tn)
          if tp + fp > 0:
              PPV = tp / (tp + fp)
              FDR = fp / (tp + fp)
          if tn + fn > 0:
              NPV = tn / (tn + fn)
              FOR = fn / (tn + fn)
          if fp + tp + fn + tn > 0:
              ACC = (tp + tn) / (tp + tn + fp + fn)
              STP = (tp + fp) / (tp + tn + fp + fn)
  
          cf_metrics = {
              "TPR": TPR,
              "TNR": TNR,
              "PPV": PPV,
              "NPV": NPV,
              "FNR": FNR,
              "FPR": FPR,
              "FDR": FDR,
              "FOR": FOR,
              "ACC": ACC,
              "STP": STP,
          }
  
          for metric in cf_metrics.keys():
              if not pd.isna(cf_metrics.get(metric)):
                  cf_metrics[metric] = round(cf_metrics.get(metric), 3)
  
          subgroup_confusion_matrix_metrics[sub] = deepcopy(cf_metrics)
  
      self.subgroup_confusion_matrix_metrics = (
          subgroup_confusion_matrix_metrics
      )
  
imports: from copy import deepcopy
  import numpy
  import pandas
  from .None import checks
  from ...None import _global_checks
  from ..._explainer import helper
  from ...model_explanations._model_performance import utils
label_desc: Use image node_id 1 to create a new SubgroupConfusionMatrixMetrics object  with example: obj = SubgroupConfusionMatrixMetrics(sub_confusion_matrix)