class_docstr: Learning fair representations is a pre-processing technique that finds a
  latent representation which encodes the data well but obfuscates information
  about protected attributes [2]_.
  References:
      .. [2] R. Zemel, Y. Wu, K. Swersky, T. Pitassi, and C. Dwork,  "Learning
         Fair Representations." International Conference on Machine Learning,
         2013.
  Based on code from https://github.com/zjelveh/learning-fair-representations
docstr: Transform the dataset using learned model parameters.
  Args:
      dataset (BinaryLabelDataset): Dataset containing labels that needs to be transformed.
      threshold(float, optional): threshold parameter used for binary label prediction.
  Returns:
      dataset (BinaryLabelDataset): Transformed Dataset.
code: def transform(self, dataset, threshold=0.5):
      """Transform the dataset using learned model parameters.
      Args:
          dataset (BinaryLabelDataset): Dataset containing labels that needs to be transformed.
          threshold(float, optional): threshold parameter used for binary label prediction.
      Returns:
          dataset (BinaryLabelDataset): Transformed Dataset.
      """
      if self.seed is not None:
          np.random.seed(self.seed)
  
      protected_attributes = np.reshape(
          dataset.protected_attributes[
              :,
              dataset.protected_attribute_names.index(
                  self.protected_attribute_name
              ),
          ],
          [-1, 1],
      )
      unprivileged_sample_ids = np.array(
          np.where(
              protected_attributes
              == self.unprivileged_group_protected_attribute_value
          )
      )[0].flatten()
      privileged_sample_ids = np.array(
          np.where(
              protected_attributes
              == self.privileged_group_protected_attribute_value
          )
      )[0].flatten()
      features_unprivileged = dataset.features[unprivileged_sample_ids]
      features_privileged = dataset.features[privileged_sample_ids]
  
      (
          _,
          features_hat_unprivileged,
          labels_hat_unprivileged,
      ) = lfr_helpers.get_xhat_y_hat(
          self.prototypes, self.w, features_unprivileged
      )
  
      (
          _,
          features_hat_privileged,
          labels_hat_privileged,
      ) = lfr_helpers.get_xhat_y_hat(
          self.prototypes, self.w, features_privileged
      )
  
      transformed_features = np.zeros(shape=np.shape(dataset.features))
      transformed_labels = np.zeros(shape=np.shape(dataset.labels))
      transformed_features[
          unprivileged_sample_ids
      ] = features_hat_unprivileged
      transformed_features[
          privileged_sample_ids
      ] = features_hat_privileged
      transformed_labels[unprivileged_sample_ids] = np.reshape(
          labels_hat_unprivileged, [-1, 1]
      )
      transformed_labels[privileged_sample_ids] = np.reshape(
          labels_hat_privileged, [-1, 1]
      )
      transformed_bin_labels = (
          np.array(transformed_labels) > threshold
      ).astype(np.float64)
  
      # Mutated, fairer dataset with new labels
      dataset_new = dataset.copy(deepcopy=True)
      dataset_new.features = transformed_features
      dataset_new.labels = transformed_bin_labels
      dataset_new.scores = np.array(transformed_labels)
  
      return dataset_new
  
file_path: AIF360/aif360/algorithms/preprocessing/lfr.py
imports: import numpy
  import scipy.optimize
  from aif360.algorithms import Transformer
  from aif360.algorithms.preprocessing.lfr_helpers import helpers
label_desc: Use image node_id 3 for calling the LFR obj's underlying member method code with example usage: obj.transform(dataset, threshold) and returns: dataset_new