class_docstr: Model is an algorithm for learning classifiers that are fair with respect
  to rich subgroups.
  
  Rich subgroups are defined by (linear) functions over the sensitive
  attributes, and fairness notions are statistical: false positive, false
  negative, and statistical parity rates. This implementation uses a max of
  two regressions as a cost-sensitive classification oracle, and supports
  linear regression, support vector machines, decision trees, and kernel
  regression. For details see:
  
  References:
      .. [1] "Preventing Fairness Gerrymandering: Auditing and Learning for
         Subgroup Fairness." Michale Kearns, Seth Neel, Aaron Roth, Steven Wu.
         ICML '18.
      .. [2] "An Empirical Study of Rich Subgroup Fairness for Machine
         Learning". Michael Kearns, Seth Neel, Aaron Roth, Steven Wu. FAT '19.
docstr: Return dataset object where labels are the predictions returned by
  the fitted model.
  
  Args:
      dataset: dataset object with its own class definition in datasets
          folder inherits from class StandardDataset.
      threshold: The positive prediction cutoff for the soft-classifier.
  
  Returns:
      dataset_new: modified dataset object where the labels attribute are
      the predictions returned by the self model
docstr_tok: ["Return","dataset","object","where","labels","are","the","predictions","returned","by","the","fitted","model",".","Args",":","dataset",":","dataset","object","with","its","own","class","definition","in","datasets","folder","inherits","from","class","StandardDataset",".","threshold",":","The","positive","prediction","cutoff","for","the","soft-classifier",".","Returns",":","dataset_new",":","modified","dataset","object","where","the","labels","attribute","are","the","predictions","returned","by","the","self","model"]
code: def predict(self, dataset, threshold=0.5):
      """Return dataset object where labels are the predictions returned by
      the fitted model.
  
      Args:
          dataset: dataset object with its own class definition in datasets
              folder inherits from class StandardDataset.
          threshold: The positive prediction cutoff for the soft-classifier.
  
      Returns:
          dataset_new: modified dataset object where the labels attribute are
          the predictions returned by the self model
      """
  
      # Generates predictions.
      dataset_new = copy.deepcopy(dataset)
      data, _, _ = clean.extract_df_from_ds(dataset_new)
      num_classifiers = len(self.classifiers)
      y_hat = None
      for hyp in self.classifiers:
          new_predictions = hyp.predict(data) / num_classifiers
          if y_hat is None:
              y_hat = new_predictions
          else:
              y_hat = np.add(y_hat, new_predictions)
      if threshold:
          dataset_new.labels = np.asarray(
              [1 if y >= threshold else 0 for y in y_hat]
          )
      else:
          dataset_new.labels = np.asarray([y for y in y_hat])
      # ensure ndarray is formatted correctly
      dataset_new.labels.resize(dataset.labels.shape, refcheck=True)
      return dataset_new
  
file_path: AIF360/aif360/algorithms/inprocessing/gerryfair_classifier.py
imports: import copy
  from aif360.algorithms.inprocessing.gerryfair import heatmap
  from aif360.algorithms.inprocessing.gerryfair.clean import array_to_tuple
  from aif360.algorithms.inprocessing.gerryfair.learner import Learner
  from aif360.algorithms.inprocessing.gerryfair.auditor import *
  from aif360.algorithms.inprocessing.gerryfair.classifier_history import ClassifierHistory
  from aif360.algorithms import Transformer
label_desc: Use image node_id 3 for calling the GerryFairClassifier obj's underlying member method code with example usage: obj.predict(dataset, threshold) and returns: dataset_new