Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def binary_confusion_matrix(self, privileged=None):
"""Compute the number of true/false positives/negatives, optionally
conditioned on protected attributes.
Args:
privileged (bool, optional): Boolean prescribing whether to
condition this metric on the `privileged_groups`, if `True`, or
the `unprivileged_groups`, if `False`. Defaults to `None`
meaning this metric is computed over the entire dataset.
Returns:
dict: Number of true positives, false positives, true negatives,
false negatives (optionally conditioned).
"""
condition = self._to_condition(privileged)
return utils.compute_num_TF_PN(self.dataset.protected_attributes,
self.dataset.labels, self.classified_dataset.labels,
self.dataset.instance_weights,
self.dataset.protected_attribute_names,
self.dataset.favorable_label, self.dataset.unfavorable_label,
condition=condition)