class_docstr: Fair Data Adaptation.
  
  Fairadapt is a pre-processing technique that can be used for both fair
  classification and fair regression [#plecko20]_. The method is a causal
  inference approach to bias removal and it relies on the causal graph for
  the dataset. The original implementation is in R [#plecko21]_.
  
  References:
      .. [#plecko20] `D. Plečko and N. Meinshausen,
         "Fair Data Adaptation with Quantile Preservation,"
         Journal of Machine Learning Research, 2020.
         <https://www.jmlr.org/papers/volume21/19-966/19-966.pdf>`_
      .. [#plecko21] `D. Plečko and N. Bennett and N. Meinshausen,
         "FairAdapt: Causal Reasoning for Fair Data Pre-processing,"
         arXiv, 2021. <https://arxiv.org/abs/2110.10200>`_
  
  Attributes:
      prot_attr_ (str or list(str)): Protected attribute(s) used for fair data
          adaptation.
      groups_ (array, shape (n_groups,)): A list of group labels known to the
          transformer.
docstr: Args:
      prot_attr (single label): Name of the protected attribute. Must be
          binary.
      adj_mat (array-like): A 2-dimensional array representing the
          adjacency matrix of the causal diagram of the data generating
          process. Row/column order must match `X_train`.
code: def __init__(self, prot_attr, adj_mat):
      """
      Args:
          prot_attr (single label): Name of the protected attribute. Must be
              binary.
          adj_mat (array-like): A 2-dimensional array representing the
              adjacency matrix of the causal diagram of the data generating
              process. Row/column order must match `X_train`.
      """
      self.prot_attr = prot_attr
      self.adj_mat = adj_mat
  
      # R packages need to run FairAdapt
      pkgs = ("ranger", "fairadapt")
      # selectively install the missing packages
      pkgs = [p for p in pkgs if not robjects.packages.isinstalled(p)]
      if len(pkgs) > 0:
          utls = robjects.packages.importr("utils")
          utls.chooseCRANmirror(ind=1)
          utls.install_packages(StrVector(pkgs))
  
file_path: AIF360/aif360/sklearn/preprocessing/fairadapt.py
imports: import os.path
  import pandas
  import numpy
  from sklearn.base import BaseEstimator
  from aif360.sklearn.utils import check_inputs, check_groups
label_desc: Use image node_id 1 to create a new FairAdapt object from inherited base classes: BaseEstimator with example: obj = FairAdapt(prot_attr, adj_mat)