aif360.metrics.utils.compute_num_gen_TF_PN

aif360.metrics.utils.compute_num_gen_TF_PN(X, y_true, y_score, w, feature_names, favorable_label, unfavorable_label, condition=None)[source]

Compute the number of generalized true/false positives/negatives optionally conditioned on protected attributes. Generalized counts are based on scores and not on the hard predictions.

Parameters:
  • X (numpy.ndarray) – Dataset features.

  • y_true (numpy.ndarray) – True label vector.

  • y_score (numpy.ndarray) – Predicted score vector. Values range from 0 to 1. 0 implies prediction for unfavorable label and 1 implies prediction for favorable label.

  • 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 compute_boolean_conditioning_vector().

Returns:

Number of positives/negatives (optionally conditioned).