aif360.sklearn.metrics.num_pos_neg

aif360.sklearn.metrics.num_pos_neg(y_true, y_pred=None, pos_label=1, sample_weight=None)[source]

Compute the number of positive and negative samples.

Parameters:
  • y_true (array-like) – Ground truth (correct) target values. If y_pred is provided, this is ignored.

  • y_pred (array-like) – Estimated targets as returned by a classifier.

  • pos_label (scalar, optional) – The label of the positive class.

  • sample_weight (array-like, optional) – Sample weights.

Returns:

tuple – Number of positives and negatives.

  • n_positive (float) – (Weighted) number of positive samples.

  • n_negative (float) – (Weighted) number of negative samples.