class_docstr: Debiasing with adversarial learning.
  
  Adversarial debiasing is an in-processing technique that learns a
  classifier to maximize prediction accuracy and simultaneously reduce an
  adversary's ability to determine the protected attribute from the
  predictions [#zhang18]_. This approach leads to a fair classifier as the
  predictions cannot carry any group discrimination information that the
  adversary can exploit.
  
  References:
      .. [#zhang18] `B. H. Zhang, B. Lemoine, and M. Mitchell, "Mitigating
         Unwanted Biases with Adversarial Learning," AAAI/ACM Conference on
         Artificial Intelligence, Ethics, and Society, 2018.
         <https://dl.acm.org/citation.cfm?id=3278779>`_
  
  Attributes:
      prot_attr_ (str or list(str)): Protected attribute(s) used for
          debiasing.
      groups_ (array, shape (n_groups,)): A list of group labels known to the
          classifier.
      classes_ (array, shape (n_classes,)): A list of class labels known to
          the classifier.
      sess_ (tensorflow.Session): The TensorFlow Session used for the
          computations. Note: this can be manually closed to free up resources
          with `self.sess_.close()`.
      classifier_logits_ (tensorflow.Tensor): Tensor containing output logits
          from the classifier.
      adversary_logits_ (tensorflow.Tensor): Tensor containing output logits
          from the adversary.
class_docstr_tok: ["Debiasing","with","adversarial","learning",".","Adversarial","debiasing","is","an","in-processing","technique","that","learns","a","classifier","to","maximize","prediction","accuracy","and","simultaneously","reduce","an","adversary","'s","ability","to","determine","the","protected","attribute","from","the","predictions","[","#","zhang18","]","_",".","This","approach","leads","to","a","fair","classifier","as","the","predictions","can","not","carry","any","group","discrimination","information","that","the","adversary","can","exploit",".","References",":","..","[","#","zhang18","]","`","B.","H.","Zhang",",","B.","Lemoine",",","and","M.","Mitchell",",","``","Mitigating","Unwanted","Biases","with","Adversarial","Learning",",","''","AAAI\/ACM","Conference","on","Artificial","Intelligence",",","Ethics",",","and","Society",",","2018",".","<","https",":","\/\/dl.acm.org\/citation.cfm","?","id=3278779",">","`","_","Attributes",":","prot_attr_","(","str","or","list","(","str",")",")",":","Protected","attribute","(","s",")","used","for","debiasing",".","groups_","(","array",",","shape","(","n_groups",",",")",")",":","A","list","of","group","labels","known","to","the","classifier",".","classes_","(","array",",","shape","(","n_classes",",",")",")",":","A","list","of","class","labels","known","to","the","classifier",".","sess_","(","tensorflow.Session",")",":","The","TensorFlow","Session","used","for","the","computations",".","Note",":","this","can","be","manually","closed","to","free","up","resources","with","`","self.sess_.close","(",")","`",".","classifier_logits_","(","tensorflow.Tensor",")",":","Tensor","containing","output","logits","from","the","classifier",".","adversary_logits_","(","tensorflow.Tensor",")",":","Tensor","containing","output","logits","from","the","adversary","."]
docstr: Args:
      prot_attr (single label or list-like, optional): Protected
          attribute(s) to use in the debiasing 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.
      scope_name (str, optional): TensorFlow "variable_scope" name for the
          entire model (classifier and adversary).
      adversary_loss_weight (float or ``None``, optional): If ``None``,
          this will use the suggestion from the paper:
          :math:`\alpha = \sqrt{global\_step}` with inverse time decay on
          the learning rate. Otherwise, it uses the provided coefficient
          with exponential learning rate decay.
      num_epochs (int, optional): Number of epochs for which to train.
      batch_size (int, optional): Size of mini-batch for training.
      classifier_num_hidden_units (int, optional): Number of hidden units
          in the classifier.
      debias (bool, optional): If ``False``, learn a classifier without an
          adversary.
      verbose (bool, optional): If ``True``, print losses every 200 steps.
      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","debiasing","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",".","scope_name","(","str",",","optional",")",":","TensorFlow","``","variable_scope","''","name","for","the","entire","model","(","classifier","and","adversary",")",".","adversary_loss_weight","(","float","or","``","None","``",",","optional",")",":","If","``","None","``",",","this","will","use","the","suggestion","from","the","paper",":",":","math",":","`","\\alpha","=","\\sqrt","{","global\\_step","}","`","with","inverse","time","decay","on","the","learning","rate",".","Otherwise",",","it","uses","the","provided","coefficient","with","exponential","learning","rate","decay",".","num_epochs","(","int",",","optional",")",":","Number","of","epochs","for","which","to","train",".","batch_size","(","int",",","optional",")",":","Size","of","mini-batch","for","training",".","classifier_num_hidden_units","(","int",",","optional",")",":","Number","of","hidden","units","in","the","classifier",".","debias","(","bool",",","optional",")",":","If","``","False","``",",","learn","a","classifier","without","an","adversary",".","verbose","(","bool",",","optional",")",":","If","``","True","``",",","print","losses","every","200","steps",".","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,
      scope_name="classifier",
      adversary_loss_weight=0.1,
      num_epochs=50,
      batch_size=128,
      classifier_num_hidden_units=200,
      debias=True,
      verbose=False,
      random_state=None,
  ):
      r"""
      Args:
          prot_attr (single label or list-like, optional): Protected
              attribute(s) to use in the debiasing 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.
          scope_name (str, optional): TensorFlow "variable_scope" name for the
              entire model (classifier and adversary).
          adversary_loss_weight (float or ``None``, optional): If ``None``,
              this will use the suggestion from the paper:
              :math:`\alpha = \sqrt{global\_step}` with inverse time decay on
              the learning rate. Otherwise, it uses the provided coefficient
              with exponential learning rate decay.
          num_epochs (int, optional): Number of epochs for which to train.
          batch_size (int, optional): Size of mini-batch for training.
          classifier_num_hidden_units (int, optional): Number of hidden units
              in the classifier.
          debias (bool, optional): If ``False``, learn a classifier without an
              adversary.
          verbose (bool, optional): If ``True``, print losses every 200 steps.
          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.scope_name = scope_name
      self.adversary_loss_weight = adversary_loss_weight
      self.num_epochs = num_epochs
      self.batch_size = batch_size
      self.classifier_num_hidden_units = classifier_num_hidden_units
      self.debias = debias
      self.verbose = verbose
      self.random_state = random_state
  
file_path: AIF360/aif360/sklearn/inprocessing/adversarial_debiasing.py
imports: import numpy
  import scipy.special
  from sklearn.base import BaseEstimator, ClassifierMixin
  from sklearn.preprocessing import LabelEncoder
  from sklearn.utils import check_random_state
  from sklearn.utils.validation import check_is_fitted
  from aif360.sklearn.utils import check_inputs, check_groups
label_desc: Use image node_id 1 to create a new AdversarialDebiasing object from inherited base classes: BaseEstimator, ClassifierMixin with example: obj = AdversarialDebiasing(prot_attr, scope_name, adversary_loss_weight, num_epochs, batch_size, classifier_num_hidden_units, debias, verbose, random_state)