class_docstr: Reweighing is a preprocessing technique that Weights the examples in each
  (group, label) combination differently to ensure fairness before
  classification [4]_.
  
  References:
      .. [4] F. Kamiran and T. Calders,  "Data Preprocessing Techniques for
         Classification without Discrimination," Knowledge and Information
         Systems, 2012.
docstr: Compute the weights for reweighing the dataset.
  
  Args:
      dataset (BinaryLabelDataset): Dataset containing true labels.
  
  Returns:
      Reweighing: Returns self.
code: def fit(self, dataset):
      """Compute the weights for reweighing the dataset.
  
      Args:
          dataset (BinaryLabelDataset): Dataset containing true labels.
  
      Returns:
          Reweighing: Returns self.
      """
  
      (
          priv_cond,
          unpriv_cond,
          fav_cond,
          unfav_cond,
          cond_p_fav,
          cond_p_unfav,
          cond_up_fav,
          cond_up_unfav,
      ) = self._obtain_conditionings(dataset)
  
      n = np.sum(dataset.instance_weights, dtype=np.float64)
      n_p = np.sum(
          dataset.instance_weights[priv_cond], dtype=np.float64
      )
      n_up = np.sum(
          dataset.instance_weights[unpriv_cond], dtype=np.float64
      )
      n_fav = np.sum(
          dataset.instance_weights[fav_cond], dtype=np.float64
      )
      n_unfav = np.sum(
          dataset.instance_weights[unfav_cond], dtype=np.float64
      )
  
      n_p_fav = np.sum(
          dataset.instance_weights[cond_p_fav], dtype=np.float64
      )
      n_p_unfav = np.sum(
          dataset.instance_weights[cond_p_unfav], dtype=np.float64
      )
      n_up_fav = np.sum(
          dataset.instance_weights[cond_up_fav], dtype=np.float64
      )
      n_up_unfav = np.sum(
          dataset.instance_weights[cond_up_unfav], dtype=np.float64
      )
  
      # reweighing weights
      self.w_p_fav = n_fav * n_p / (n * n_p_fav)
      self.w_p_unfav = n_unfav * n_p / (n * n_p_unfav)
      self.w_up_fav = n_fav * n_up / (n * n_up_fav)
      self.w_up_unfav = n_unfav * n_up / (n * n_up_unfav)
  
      return self
  
file_path: AIF360/aif360/algorithms/preprocessing/reweighing.py
imports: import numpy
  from aif360.algorithms import Transformer
  from aif360.metrics import utils
label_desc: Use image node_id 2 for calling the Reweighing obj's underlying member method code with example usage: obj.fit(dataset) and returns: self