class_docstr: Prejudice remover is an in-processing technique that adds a
  discrimination-aware regularization term to the learning objective [6]_.
  
  References:
      .. [6] T. Kamishima, S. Akaho, H. Asoh, and J. Sakuma, "Fairness-Aware
         Classifier with Prejudice Remover Regularizer," Joint European
         Conference on Machine Learning and Knowledge Discovery in Databases,
         2012.
class_docstr_tok: ["Prejudice","remover","is","an","in-processing","technique","that","adds","a","discrimination-aware","regularization","term","to","the","learning","objective","[","6","]","_.","References",":","..","[","6","]","T.","Kamishima",",","S.","Akaho",",","H.","Asoh",",","and","J.","Sakuma",",","``","Fairness-Aware","Classifier","with","Prejudice","Remover","Regularizer",",","''","Joint","European","Conference","on","Machine","Learning","and","Knowledge","Discovery","in","Databases",",","2012","."]
docstr: Obtain the predictions for the provided dataset using the learned
  prejudice remover model.
  
  Args:
      dataset (BinaryLabelDataset): Dataset containing labels that needs
          to be transformed.
  Returns:
      dataset (BinaryLabelDataset): Transformed dataset.
docstr_tok: ["Obtain","the","predictions","for","the","provided","dataset","using","the","learned","prejudice","remover","model",".","Args",":","dataset","(","BinaryLabelDataset",")",":","Dataset","containing","labels","that","needs","to","be","transformed",".","Returns",":","dataset","(","BinaryLabelDataset",")",":","Transformed","dataset","."]
code: def predict(self, dataset):
      """Obtain the predictions for the provided dataset using the learned
      prejudice remover model.
  
      Args:
          dataset (BinaryLabelDataset): Dataset containing labels that needs
              to be transformed.
      Returns:
          dataset (BinaryLabelDataset): Transformed dataset.
      """
      data = np.column_stack([dataset.features, dataset.labels])
      columns = dataset.feature_names + dataset.label_names
      test_df = pd.DataFrame(data=data, columns=columns)
      sens_df = pd.Series(
          dataset.protected_attributes[:, self.sensitive_ind],
          name=self.sensitive_attr,
      )
  
      fd, output_name = tempfile.mkstemp()
      os.close(fd)
  
      test_name = self._create_file_in_kamishima_format(
          test_df,
          self.class_attr,
          dataset.favorable_label,
          dataset.protected_attribute_names,
          sens_df,
          dataset.privileged_protected_attributes[self.sensitive_ind],
      )
  
      # ADDED FOLLOWING LINE to get absolute path of this file, i.e.
      # prejudice_remover.py
      k_path = os.path.dirname(os.path.abspath(__file__))
      predict_lr = os.path.join(
          k_path, "kamfadm-2012ecmlpkdd", "predict_lr.py"
      )
      # changed paths in the calls below to (a) specify path of train_pr,
      # predict_lr RELATIVE to this file, and (b) compute & use absolute path,
      # and (c) replace python3 with python
      subprocess.call(
          [
              "python",
              predict_lr,
              "-i",
              test_name,
              "-m",
              self.model_name,
              "-o",
              output_name,
              "--quiet",
          ]
      )
      os.unlink(test_name)
      m = np.loadtxt(output_name)
      os.unlink(output_name)
  
      pred_dataset = dataset.copy()
      # Columns of Outputs: (as per Kamishima implementation predict_lr.py)
      # 0. true sample class number
      # 1. predicted class number
      # 2. sensitive feature
      # 3. class 0 probability
      # 4. class 1 probability
      pred_dataset.labels = m[:, [1]]
      pred_dataset.scores = m[:, [4]]
  
      return pred_dataset
  
file_path: AIF360/aif360/algorithms/inprocessing/prejudice_remover.py
imports: import numpy
  import pandas
  import tempfile
  import os
  import subprocess
  from aif360.algorithms import Transformer
label_desc: Use image node_id 4 for calling the PrejudiceRemover obj's underlying member method code with example usage: obj.predict(dataset) and returns: pred_dataset