class_docstr: Learned Fair Representations.
  
  Learned fair representations is a pre-processing technique that finds a
  latent representation which encodes the data well but obfuscates information
  about protected attributes [#zemel13]_. It can also be used as an in-
  processing method by utilizing the learned target coefficients.
  
  References:
      .. [#zemel13] `R. Zemel, Y. Wu, K. Swersky, T. Pitassi, and C. Dwork,
         "Learning Fair Representations." International Conference on Machine
         Learning, 2013. <http://proceedings.mlr.press/v28/zemel13.html>`_
  
  # Based on code from https://github.com/zjelveh/learning-fair-representations
  
  Attributes:
      prot_attr_ (str or list(str)): Protected attribute(s) used for
          reweighing.
      groups_ (array, shape (n_groups,)): A list of group labels known to the
          transformer.
      classes_ (array, shape (n_classes,)): A list of class labels known to
          the transformer.
      priv_group_ (scalar): The label of the privileged group.
      coef_ (array, shape (n_prototypes, 1) or (n_prototypes, n_classes)):
          Coefficient of the intermediate representation for classification.
      prototypes_ (array, shape (n_prototypes, n_features)): The prototype set
          used to form a probabilistic mapping to the intermediate
          representation. These act as clusters and are in the same space as
          the samples.
      n_iter_ (int): Actual number of iterations.
class_docstr_tok: ["Learned","Fair","Representations",".","Learned","fair","representations","is","a","pre-processing","technique","that","finds","a","latent","representation","which","encodes","the","data","well","but","obfuscates","information","about","protected","attributes","[","#","zemel13","]","_",".","It","can","also","be","used","as","an","in-","processing","method","by","utilizing","the","learned","target","coefficients",".","References",":","..","[","#","zemel13","]","`","R.","Zemel",",","Y.","Wu",",","K.","Swersky",",","T.","Pitassi",",","and","C.","Dwork",",","``","Learning","Fair","Representations",".","''","International","Conference","on","Machine","Learning",",","2013",".","<","http",":","\/\/proceedings.mlr.press\/v28\/zemel13.html",">","`","_","#","Based","on","code","from","https",":","\/\/github.com\/zjelveh\/learning-fair-representations","Attributes",":","prot_attr_","(","str","or","list","(","str",")",")",":","Protected","attribute","(","s",")","used","for","reweighing",".","groups_","(","array",",","shape","(","n_groups",",",")",")",":","A","list","of","group","labels","known","to","the","transformer",".","classes_","(","array",",","shape","(","n_classes",",",")",")",":","A","list","of","class","labels","known","to","the","transformer",".","priv_group_","(","scalar",")",":","The","label","of","the","privileged","group",".","coef_","(","array",",","shape","(","n_prototypes",",","1",")","or","(","n_prototypes",",","n_classes",")",")",":","Coefficient","of","the","intermediate","representation","for","classification",".","prototypes_","(","array",",","shape","(","n_prototypes",",","n_features",")",")",":","The","prototype","set","used","to","form","a","probabilistic","mapping","to","the","intermediate","representation",".","These","act","as","clusters","and","are","in","the","same","space","as","the","samples",".","n_iter_","(","int",")",":","Actual","number","of","iterations","."]
docstr: Args:
      prot_attr (single label or list-like, optional): Protected
          attribute(s) to use in the reweighing process. If more than one
          attribute, all combinations of values (intersections) are
          considered. Default is ``None`` meaning all protected attributes
          from the dataset are used.
      n_prototypes (int, optional): Size of the set of "prototypes," Z.
      reconstruct_weight (float, optional): Weight coefficient on the L_x
          loss term, A_x.
      target_weight (float, optional): Weight coefficient on the L_y loss
          term, A_y.
      fairness_weight (float, optional): Weight coefficient on the L_z
          loss term, A_z.
      tol (float, optional): Tolerance for stopping criteria.
      max_iter (int, optional): Maximum number of iterations taken for the
          solver to converge.
      verbose (int, optional): Verbosity. 0 = silent, 1 = final loss only,
          2 = print loss every 50 iterations.
      random_state (int or numpy.RandomState, optional): Seed of pseudo-
          random number generator for shuffling data and seeding weights.
docstr_tok: ["Args",":","prot_attr","(","single","label","or","list-like",",","optional",")",":","Protected","attribute","(","s",")","to","use","in","the","reweighing","process",".","If","more","than","one","attribute",",","all","combinations","of","values","(","intersections",")","are","considered",".","Default","is","``","None","``","meaning","all","protected","attributes","from","the","dataset","are","used",".","n_prototypes","(","int",",","optional",")",":","Size","of","the","set","of","``","prototypes",",","''","Z.","reconstruct_weight","(","float",",","optional",")",":","Weight","coefficient","on","the","L_x","loss","term",",","A_x",".","target_weight","(","float",",","optional",")",":","Weight","coefficient","on","the","L_y","loss","term",",","A_y",".","fairness_weight","(","float",",","optional",")",":","Weight","coefficient","on","the","L_z","loss","term",",","A_z",".","tol","(","float",",","optional",")",":","Tolerance","for","stopping","criteria",".","max_iter","(","int",",","optional",")",":","Maximum","number","of","iterations","taken","for","the","solver","to","converge",".","verbose","(","int",",","optional",")",":","Verbosity",".","0","=","silent",",","1","=","final","loss","only",",","2","=","print","loss","every","50","iterations",".","random_state","(","int","or","numpy.RandomState",",","optional",")",":","Seed","of","pseudo-","random","number","generator","for","shuffling","data","and","seeding","weights","."]
code: def __init__(
      self,
      prot_attr=None,
      n_prototypes=5,
      reconstruct_weight=0.01,
      target_weight=1.0,
      fairness_weight=50.0,
      tol=1e-4,
      max_iter=200,
      verbose=0,
      random_state=None,
  ):
      """
      Args:
          prot_attr (single label or list-like, optional): Protected
              attribute(s) to use in the reweighing process. If more than one
              attribute, all combinations of values (intersections) are
              considered. Default is ``None`` meaning all protected attributes
              from the dataset are used.
          n_prototypes (int, optional): Size of the set of "prototypes," Z.
          reconstruct_weight (float, optional): Weight coefficient on the L_x
              loss term, A_x.
          target_weight (float, optional): Weight coefficient on the L_y loss
              term, A_y.
          fairness_weight (float, optional): Weight coefficient on the L_z
              loss term, A_z.
          tol (float, optional): Tolerance for stopping criteria.
          max_iter (int, optional): Maximum number of iterations taken for the
              solver to converge.
          verbose (int, optional): Verbosity. 0 = silent, 1 = final loss only,
              2 = print loss every 50 iterations.
          random_state (int or numpy.RandomState, optional): Seed of pseudo-
              random number generator for shuffling data and seeding weights.
      """
      self.prot_attr = prot_attr
      self.n_prototypes = n_prototypes
      self.reconstruct_weight = reconstruct_weight
      self.target_weight = target_weight
      self.fairness_weight = fairness_weight
      self.tol = tol
      self.max_iter = max_iter
      self.verbose = verbose
      self.random_state = random_state
  
file_path: AIF360/aif360/sklearn/preprocessing/learning_fair_representations.py
imports: import warnings
  import numpy
  import pandas
  import scipy.optimize
  from scipy.spatial.distance import cdist
  from scipy.special import softmax
  from sklearn.base import BaseEstimator, ClassifierMixin, TransformerMixin
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.preprocessing import LabelEncoder
  from sklearn.utils import check_random_state
  from aif360.sklearn.utils import check_inputs, check_groups
label_desc: Use image node_id 1 to create a new LearnedFairRepresentations object from inherited base classes: BaseEstimator, ClassifierMixin, TransformerMixin with example: obj = LearnedFairRepresentations(prot_attr, n_prototypes, reconstruct_weight, target_weight, fairness_weight, tol, max_iter, verbose, random_state)