class_docstr: Class for computing metrics based on a single
  :obj:`~aif360.datasets.BinaryLabelDataset`.
class_docstr_tok: ["Class","for","computing","metrics","based","on","a","single",":","obj",":","`","~aif360.datasets.BinaryLabelDataset","`","."]
docstr: Args:
      dataset (BinaryLabelDataset): A BinaryLabelDataset.
      privileged_groups (list(dict)): Privileged groups. Format is a list
          of `dicts` where the keys are `protected_attribute_names` and
          the values are values in `protected_attributes`. Each `dict`
          element describes a single group. See examples for more details.
      unprivileged_groups (list(dict)): Unprivileged groups in the same
          format as `privileged_groups`.
  
  Raises:
      TypeError: `dataset` must be a
          :obj:`~aif360.datasets.BinaryLabelDataset` type.
docstr_tok: ["Args",":","dataset","(","BinaryLabelDataset",")",":","A","BinaryLabelDataset",".","privileged_groups","(","list","(","dict",")",")",":","Privileged","groups",".","Format","is","a","list","of","`","dicts","`","where","the","keys","are","`","protected_attribute_names","`","and","the","values","are","values","in","`","protected_attributes","`",".","Each","`","dict","`","element","describes","a","single","group",".","See","examples","for","more","details",".","unprivileged_groups","(","list","(","dict",")",")",":","Unprivileged","groups","in","the","same","format","as","`","privileged_groups","`",".","Raises",":","TypeError",":","`","dataset","`","must","be","a",":","obj",":","`","~aif360.datasets.BinaryLabelDataset","`","type","."]
code: def __init__(
      self, dataset, unprivileged_groups=None, privileged_groups=None
  ):
      """
      Args:
          dataset (BinaryLabelDataset): A BinaryLabelDataset.
          privileged_groups (list(dict)): Privileged groups. Format is a list
              of `dicts` where the keys are `protected_attribute_names` and
              the values are values in `protected_attributes`. Each `dict`
              element describes a single group. See examples for more details.
          unprivileged_groups (list(dict)): Unprivileged groups in the same
              format as `privileged_groups`.
  
      Raises:
          TypeError: `dataset` must be a
              :obj:`~aif360.datasets.BinaryLabelDataset` type.
      """
      if not isinstance(dataset, BinaryLabelDataset) and not isinstance(
          dataset, MulticlassLabelDataset
      ):
          raise TypeError(
              "'dataset' should be a BinaryLabelDataset or a MulticlassLabelDataset"
          )
  
      # sets self.dataset, self.unprivileged_groups, self.privileged_groups
      super(BinaryLabelDatasetMetric, self).__init__(
          dataset,
          unprivileged_groups=unprivileged_groups,
          privileged_groups=privileged_groups,
      )
  
      if isinstance(dataset, MulticlassLabelDataset):
          fav_label_value = 1.0
          unfav_label_value = 0.0
  
          self.dataset = self.dataset.copy()
          # Find all labels which match any of the favorable labels
          fav_idx = np.logical_or.reduce(
              np.equal.outer(
                  self.dataset.favorable_label, self.dataset.labels
              )
          )
          # Replace labels with corresponding values
          self.dataset.labels = np.where(
              fav_idx, fav_label_value, unfav_label_value
          )
  
          self.dataset.favorable_label = float(fav_label_value)
          self.dataset.unfavorable_label = float(unfav_label_value)
  
imports: import numpy
  from sklearn.neighbors import NearestNeighbors
  from aif360.algorithms.inprocessing.gerryfair.auditor import Auditor
  from aif360.datasets import BinaryLabelDataset
  from aif360.datasets.multiclass_label_dataset import MulticlassLabelDataset
  from aif360.metrics import DatasetMetric, utils
  from aif360.algorithms.inprocessing.gerryfair.clean import *
label_desc: Use image node_id 1 to create a new BinaryLabelDatasetMetric object from inherited base classes: DatasetMetric with example: obj = BinaryLabelDatasetMetric(dataset, unprivileged_groups, privileged_groups)