code: def compute_num_TF_PN(
      X,
      y_true,
      y_pred,
      w,
      feature_names,
      favorable_label,
      unfavorable_label,
      condition=None,
  ):
      """Compute the number of true/false positives/negatives optionally
      conditioned on protected attributes.
  
      Args:
          X (numpy.ndarray): Dataset features.
          y_true (numpy.ndarray): True label vector.
          y_pred (numpy.ndarray): Predicted label vector.
          w (numpy.ndarray): Instance weight vector - the true and predicted
              datasets are supposed to have same instance level weights.
          feature_names (list): names of the features.
          favorable_label (float): Value of favorable/positive label.
          unfavorable_label (float): Value of unfavorable/negative label.
          condition (list(dict)): Same format as
              :func:`compute_boolean_conditioning_vector`.
  
      Returns:
          Number of positives/negatives (optionally conditioned).
      """
      # condition if necessary
      cond_vec = compute_boolean_conditioning_vector(
          X, feature_names, condition=condition
      )
  
      # to prevent broadcasts
      y_true = y_true.ravel()
      y_pred = y_pred.ravel()
  
      y_true_pos = y_true == favorable_label
      y_true_neg = y_true == unfavorable_label
      y_pred_pos = np.logical_and(y_pred == favorable_label, cond_vec)
      y_pred_neg = np.logical_and(y_pred == unfavorable_label, cond_vec)
  
      # True/false positives/negatives
      return dict(
          TP=np.sum(
              w[np.logical_and(y_true_pos, y_pred_pos)],
              dtype=np.float64,
          ),
          FP=np.sum(
              w[np.logical_and(y_true_neg, y_pred_pos)],
              dtype=np.float64,
          ),
          TN=np.sum(
              w[np.logical_and(y_true_neg, y_pred_neg)],
              dtype=np.float64,
          ),
          FN=np.sum(
              w[np.logical_and(y_true_pos, y_pred_neg)],
              dtype=np.float64,
          ),
      )
  
imports: import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: compute_num_TF_PN(X, y_true, y_pred, w, feature_names, favorable_label, unfavorable_label, condition) and returns: dict