File size: 2,099 Bytes
d2a8669
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/inprocessing_adversarial_debiasing.R
\name{adversarial_debiasing}
\alias{adversarial_debiasing}
\title{Adversarial Debiasing}
\usage{
adversarial_debiasing(
  unprivileged_groups,
  privileged_groups,
  scope_name = "current",
  sess = tf$compat$v1$Session(),
  seed = NULL,
  adversary_loss_weight = 0.1,
  num_epochs = 50L,
  batch_size = 128L,
  classifier_num_hidden_units = 200L,
  debias = TRUE
)
}
\arguments{
\item{unprivileged_groups}{A list with two values: the column of the protected class and the value indicating representation for unprivileged group.}

\item{privileged_groups}{A list with two values: the column of the protected class and the value indicating representation for privileged group.}

\item{scope_name}{Scope name for the tensorflow variables.}

\item{sess}{tensorflow session}

\item{seed}{Seed to make \code{predict} repeatable. If not, \code{NULL}, must be an integer.}

\item{adversary_loss_weight}{Hyperparameter that chooses the strength of the adversarial loss.}

\item{num_epochs}{Number of training epochs. Must be an integer.}

\item{batch_size}{Batch size. Must be an integer.}

\item{classifier_num_hidden_units}{Number of hidden units in the classifier model. Must be an integer.}

\item{debias}{Learn a classifier with or without debiasing.}
}
\description{
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
}
\examples{
\dontrun{
load_aif360_lib()
ad <- adult_dataset()
p <- list("race", 1)
u <- list("race", 0)

sess <- tf$compat$v1$Session()

plain_model <- adversarial_debiasing(privileged_groups = p,
                                     unprivileged_groups = u,
                                     scope_name = "debiased_classifier",
                                     debias = TRUE,
                                     sess = sess)

plain_model$fit(ad)
ad_nodebiasing <- plain_model$predict(ad)
}
}