Preventing Fairness Gerrymandering: Auditing and Learning for Subgroup Fairness
Michael Kearns, Seth Neel, Aaron Roth, Zhiwei Steven Wu
Introduction
As machine learning is being deployed in increasingly consequential domains (including policing (Rudin, 2013), criminal sentencing (Barry-Jester et al., 2015), and lending (Koren, 2016)), the problem of ensuring that learned models are fair has become urgent.
Approaches to fairness in machine learning can coarsely be divided into two kinds: statistical and individual notions of fairness. Statistical notions typically fix a small number of protected demographic groups (such as racial groups), and then ask for (approximate) parity of some statistical measure across all of these groups. One popular statistical measure asks for equality of false positive or negative rates across all groups in (this is also sometimes referred to as an equal opportunity constraint (Hardt et al., 2016)). Another asks for equality of classification rates (also known as statistical parity). These statistical notions of fairness are the kinds of fairness definitions most common in the literature (see e.g. Kamiran and Calders (2012); Hajian and Domingo-Ferrer (2013); Kleinberg et al. (2017); Hardt et al. (2016); Friedler et al. (2016); Zafar et al. (2017); Chouldechova (2017)).
One main attraction of statistical definitions of fairness is that they can in principle be obtained and checked without making any assumptions about the underlying population, and hence lead to more immediately actionable algorithmic approaches. On the other hand, individual notions of fairness ask for the algorithm to satisfy some guarantee which binds at the individual, rather than group, level. This often has the semantics that “individuals who are similar” should be treated “similarly” (Dwork et al., 2012), or “less qualified individuals should not be favored over more qualified individuals” (Joseph et al., 2016). Individual notions of fairness have attractively strong semantics, but their main drawback is that achieving them seemingly requires more assumptions to be made about the setting under consideration.
The semantics of statistical notions of fairness would be significantly stronger if they were defined over a large number of subgroups, thus permitting a rich middle ground between fairness only for a small number of coarse pre-defined groups, and the strong assumptions needed for fairness at the individual level. Consider the kind of fairness gerrymandering that can occur when we only look for unfairness over a small number of pre-defined groups:
Imagine a setting with two binary features, corresponding to race (say black and white) and gender (say male and female), both of which are distributed independently and uniformly at random in a population. Consider a classifier that labels an example positive if and only if it corresponds to a black man, or a white woman. Then the classifier will appear to be equitable when one considers either protected attribute alone, in the sense that it labels both men and women as positive 50% of the time, and labels both black and white individuals as positive 50% of the time. But if one looks at any conjunction of the two attributes (such as black women), then it is apparent that the classifier maximally violates the statistical parity fairness constraint. Similarly, if examples have a binary label that is also distributed uniformly at random, and independently from the features, the classifier will satisfy equal opportunity fairness with respect to either protected attribute alone, even though it maximally violates it with respect to conjunctions of two attributes.
We remark that the issue raised by this toy example is not merely hypothetical. In our experiments in Section 5, we show that similar violations of fairness on subgroups of the pre-defined groups can result from the application of standard machine learning methods applied to real datasets. To avoid such problems, we would like to be able to satisfy a fairness constraint not just for the small number of protected groups defined by single protected attributes, but for a combinatorially large or even infinite collection of structured subgroups definable over protected attributes.
In this paper, we consider the problem of auditing binary classifiers for equal opportunity and statistical parity, and the problem of learning classifiers subject to these constraints, when the number of protected groups is large. There are exponentially many ways of carving up a population into subgroups, and we cannot necessarily identify a small number of these a priori as the only ones we need to be concerned about. At the same time, we cannot insist on any notion of statistical fairness for every subgroup of the population: for example, any imperfect classifier could be accused of being unfair to the subgroup of individuals defined ex-post as the set of individuals it misclassified. This simply corresponds to “overfitting” a fairness constraint. We note that the individual fairness definition of Joseph et al. (2016) (when restricted to the binary classification setting) can be viewed as asking for equalized false positive rates across the singleton subgroups, containing just one individual eachIt also asks for equalized false negative rates, and that the false positive rate is smaller than the true positive rate. Here, the randomness in the “rates” is taken entirely over the randomness of the classifier. — but naturally, in order to achieve this strong definition of fairness, Joseph et al. (2016) have to make structural assumptions about the form of the ground truth. It is, however, sensible to ask for fairness for large structured subsets of individuals: so long as these subsets have a bounded VC dimension, the statistical problem of learning and auditing fair classifiers is easy, so long as the dataset is sufficiently large. This can be viewed as an interpolation between equal opportunity fairness and the individual “weakly meritocratic” fairness definition from Joseph et al. (2016), that does not require making any assumptions about the ground truth. Our investigation focuses on the computational challenges, both in theory and in practice.
Formalization of the problem of auditing and learning classifiers for fairness with respect to rich classes of subgroups .
Results proving (under certain assumptions) the computational equivalence of auditing and (weak) agnostic learning of . While these results imply theoretical intractability of auditing for some natural classes , they also suggest that practical machine learning heuristics can be applied to the auditing problem.
Provably convergent algorithms for learning classifiers that are fair with respect to , based on a formulation as a two-player zero-sum game between a Learner (the primal player) and an Auditor (the dual player). We provide two different algorithms, both of which are based on solving for the equilibrium of this game. The first provably converges in a polynomial number of steps and is based on simulation of the game dynamics when the Learner uses Follow the Perturbed Leader and the Auditor uses best response; the second is only guaranteed to converge asymptotically but is computationally simpler, and involves both players using Fictitious Play.
An implementation and empirical evaluation of the Fictitious Play algorithm demonstrating its effectiveness on a real dataset in which subgroup fairness is a concern.
In more detail, we start by studying the computational challenge of simply checking whether a given classifier satisfies equal opportunity and statistical parity. Doing this in time linear in the number of protected groups is simple: for each protected group, we need only estimate a single expectation. However, when there are many different protected attributes which can be combined to define the protected groups, their number is combinatorially largeFor example, as discussed in a recent Propublica investigation (Angwin and Grassegger, 2017), Facebook policy protects groups against hate speech if the group is definable as a conjunction of protected attributes. Under the Facebook schema, “race” and “gender” are both protected attributes, and so the Facebook policy protects “black women” as a distinct class, separately from black people and women. When there are protected attributes, there are protected groups. As a statistical estimation problem, this is not a large obstacle — we can estimate expectations to error so long as our data set has size , but there is now a computational problem..
We model the problem by specifying a class of functions defined over a set of protected attributes. defines a set of protected subgroups. Each function corresponds to the protected subgroup For example, in the case of Facebook’s policy, the protected attributes include “race, sex, gender identity, religious affiliation, national origin, ethnicity, sexual orientation and serious disability/disease” (Angwin and Grassegger, 2017), and represents the class of boolean conjunctions. In other words, a group defined by individuals having any subset of values for the protected attributes is protected.. The first result of this paper is that for both equal opportunity and statistical parity, the computational problem of checking whether a classifier or decision-making algorithm violates statistical fairness with respect to the set of protected groups is equivalent to the problem of agnostically learning (Kearns et al., 1994), in a strong and distribution-specific sense. This equivalence has two implications:
First, it allows us to import computational hardness results from the learning theory literature. Agnostic learning turns out to be computationally hard in the worst case, even for extremely simple classes of functions (like boolean conjunctions and linear threshold functions). As a result, we can conclude that auditing a classifier for statistical fairness violations with respect to a class is also computationally hard. This means we should not expect to find a polynomial time algorithm that is always guaranteed to solve the auditing problem.
However, in practice, various learning heuristics (like boosting, logistic regression, SVMs, backpropagation for neural networks, etc.) are commonly used to learn accurate classifiers which are known to be hard to learn in the worst case. The equivalence we show between agnostic learning and auditing is distribution specific — that is, if on a particular data set, a heuristic learning algorithm can solve the agnostic learning problem (on an appropriately defined subset of the data), it can be used also to solve the auditing problem on the same data set.
Next, we consider the problem of learning a classifier that equalizes false positive or negative rates across all (possibly infinitely many) sub-groups, defined by a class of functions . As per the reductions described above, this problem is computationally hard in the worst case.
However, under the assumption that we have an efficient oracles which solves the agnostic learning problem, we give and analyze algorithms for this problem based on a game-theoretic formulation. We first prove that the optimal fair classifier can be found as the equilibrium of a two-player, zero-sum game, in which the (pure) strategy space of the “Learner” player corresponds to classifiers in , and the (pure) strategy space of the “Auditor” player corresponds to subgroups defined by . The best response problems for the two players correspond to agnostic learning and auditing, respectively. We show that both problems can be solved with a single call to a cost sensitive classification oracle, which is equivalent to an agnostic learning oracle. We then draw on extant theory for learning in games and no-regret algorithms to derive two different algorithms based on simulating game play in this formulation. In the first, the Learner employs the well-studied Follow the Perturbed Leader (FTPL) algorithm on an appropriate linearization of its best-response problem, while the Auditor approximately best-responds to the distribution over classifiers of the Learner at each step. Since FTPL has a no-regret guarantee, we obtain an algorithm that provably converges in a polynomial number of steps.
While it enjoys strong provable guarantees, this first algorithm is randomized (due to the noise added by FTPL), and the best-response step for the Auditor is polynomial time but computationally expensive. We thus propose a second algorithm that is deterministic, simpler and faster per step, based on both players adopting the Fictitious Play learning dynamic. This algorithm has weaker theoretical guarantees: it has provable convergence only asymptotically, and not in a polynomial number of steps — but is more practical and converges rapidly in practice. The derivation of these algorithms (and their guarantees) appear in Section 4.
Finally, we implement the Fictitious Play algorithm and demonstrate its practicality by efficiently learning classifiers that approximately equalize false positive rates across any group definable by a linear threshold function on 18 protected attributes in the “Communities and Crime” dataset. We use simple, fast regression algorithms as heuristics to implement agnostic learning oracles, and (via our reduction from agnostic learning to auditing) auditing oracles. Our results suggest that it is possible in practice to learn fair classifiers with respect to a large class of subgroups that still achieve non-trivial error. Full details are contained in Section 5, and for a substantially more comprehensive empirical investigation of our method we direct the interested reader to Kearns et al. (2018).
2 Further Related Work
Independent of our work, Hébert-Johnson et al. (2017) also consider a related and complementary notion of fairness that they call “multicalibration”. In settings in which one wishes to train a real-valued predictor, multicalibration can be considered the “calibration” analogue for the definitions of subgroup fairness that we give for false positive rates, false negative rates, and classification rates. For a real-valued predictor, calibration informally requires that for every value predicted by an algorithm, the fraction of individuals who truly have a positive label in the subset of individuals on which the algorithm predicted should be approximately equal to . Multicalibration asks for approximate calibration on every set defined implicitly by some circuit in a set . Hébert-Johnson et al. (2017) give an algorithmic result that is analogous to the one we give for learning subgroup fair classifiers: a polynomial time algorithm for learning a multi-calibrated predictor, given an agnostic learning algorithm for . In addition to giving a polynomial-time algorithm, we also give a practical variant of our algorithm (which is however only guaranteed to converge in the limit) that we use to conduct empirical experiments on real data.
Thematically, the most closely related piece of prior work is Zhang and Neill (2016), who also aim to audit classification algorithms for discrimination in subgroups that have not been pre-defined. Our work differs from theirs in a number of important ways. First, we audit the algorithm for common measures of statistical unfairness, whereas Zhang and Neill (2016) design a new measure compatible with their particular algorithmic technique. Second, we give a formal analysis of our algorithm. Finally, we audit with respect to subgroups defined by a class of functions , which we can take to have bounded VC dimension, which allows us to give formal out-of-sample guarantees. Zhang and Neill (2016) attempt to audit with respect to all possible sub-groups, which introduces a severe multiple-hypothesis testing problem, and risks overfitting. Most importantly we give actionable algorithms for learning subgroup fair classifiers, whereas Zhang and Neill (2016) restrict attention to auditing.
Technically, the most closely related piece of work (and from which we take inspiration for our algorithm in Section 4) is Agarwal et al. (2017), who show that given access to an agnostic learning oracle for a class , there is an efficient algorithm to find the lowest-error distribution over classifiers in subject to equalizing false positive rates across polynomially many subgroups. Their algorithm can be viewed as solving the same zero-sum game that we solve, but in which the “subgroup” player plays gradient descent over his pure strategies, one for each sub-group. This ceases to be an efficient or practical algorithm when the number of subgroups is large, as is our case. Our main insight is that an agnostic learning oracle is sufficient to have the both players play “fictitious play”, and that there is a transformation of the best response problem such that an agnostic learning algorithm is enough to efficiently implement follow the perturbed leader.
There is also other work showing computational hardness for fair learning problems. Most notably, Woodworth et al. (2017) show that finding a linear threshold classifier that approximately minimizes hinge loss subject to equalizing false positive rates across populations is computationally hard (assuming that refuting a random -XOR formula is hard). In contrast, we show that even checking whether a classifier satisfies a false positive rate constraint on a particular data set is computationally hard (if the number of subgroups on which fairness is desired is too large to enumerate).
Model and Preliminaries
We model each individual as being described by a tuple , where denotes a vector of protected attributes, denotes a vector of unprotected attributes, and denotes a label. Note that in our formulation, an auditing algorithm not only may not see the unprotected attributes , it may not even be aware of their existence. For example, may represent proprietary features or consumer data purchased by a credit scoring company.
We will be concerned with learning and auditing classifiers satisfying two common statistical fairness constraints: equality of classification rates (also known as statistical parity), and equality of false positive rates (also known as equal opportunity). Auditing for equality of false negative rates is symmetric and so we do not explicitly consider it. Each fairness constraint is defined with respect to a set of protected groups. We define sets of protected groups via a family of indicator functions for those groups, defined over protected attributes. Each has the semantics that indicates that an individual with protected features is in group .
Fix any classifier , distribution , collection of group indicators , and parameter . For each , define
Note that our definition references two approximation parameters, both of which are important. We are allowed to ignore a group if it (or its complement) represent only a small fraction of the total probability mass. The parameter governs how small a fraction of the population we are allowed to ignore. Similarly, we do not require that the probability of a positive classification in every subgroup is exactly equal to the base rate, but instead allow deviations up to . Both of these approximation parameters are necessary from a statistical estimation perspective. We control both of them with a single parameter .
Fix any classifier , distribution , collection of group indicators , and parameter . For each , define
We say satisfies -False Positive (FP) Fairness with respect to and if for every
This definition is symmetric to the definition of statistical parity fairness, except that the parameter is now used to exclude any group such that negative examples () from (or its complement) have probability mass less than . This is again necessary from a statistical estimation perspective.
For either statistical parity and false positive fairness, if the algorithm fails to satisfy the -fairness condition, then we say that is -unfair with respect to and . We call any subgroup which witnesses this unfairness an -unfair certificate for .
As we will show, our definition of auditing is closely related to weak agnostic learning.
Let be a distribution over and let such that . We say that the function class is -weakly agnostically learnable under distribution if there exists an algorithm such that when given sample access to , runs in time , and with probability , outputs a hypothesis such that
where .
A crucial property of a CSC problem is that the solution is invariant to translations of the costs.
We note that cost-sensitive classification is polynomially equivalent to agnostic learning Zadrozny et al. (2003). We give both definitions above because when describing our results for auditing, we wish to directly appeal to known hardness results for weak agnostic learning, but it is more convenient to describe our algorithms via oracles for cost-sensitive classification.
Follow the Perturbed Leader.
where the randomness is taken over the perturbations across rounds.
1 Generalization Error
In this section, we observe that the error rate of a classifier , as well as the degree to which it violates -fairness (for both statistical parity and false positive rates) can be accurately approximated with the empirical estimates for these quantities on a dataset (drawn i.i.d. from the underlying distribution ) so long as the dataset is sufficiently large. Once we establish this fact, since our main interest is in the computational problem of auditing and learning, in the rest of the paper, we assume that we have direct access to the underlying distribution (or equivalently, that the empirical data defines the distribution of interest), and do not make further reference to sample complexity or overfitting issues.
A standard VC dimension bound (see, e.g. Kearns and Vazirani (1994)) states:
Fix a class of functions . For any distribution , let be a dataset consisting of examples sampled i.i.d. from . Then for any , with probability , for every , we have:
Fix a class of functions and a class of group indicators . For any distribution , let be a dataset consisting of examples sampled i.i.d. from . Then for any , with probability , for every and
where denotes the empirical distribution over the realized sample .
Fix a class of functions and a class of group indicators . For any distribution , let be a dataset consisting of examples sampled i.i.d. from . Then for any , with probability , for every and , we have:
where denotes the empirical distribution over the realized sample .
Equivalence of Auditing and Weak Agnostic Learning
In this section, we give a reduction from the problem of auditing both statistical parity and false positive rate fairness, to the problem of agnostic learning, and vice versa. This has two implications. The main implication is that, from a worst-case analysis point of view, auditing is computationally hard in almost every case (since it inherits this pessimistic state of affairs from agnostic learning). However, worst-case hardness results in learning theory have not prevented the successful practice of machine learning, and there are many heuristic algorithms that in real-world cases successfully solve “hard” agnostic learning problems. Our reductions also imply that these heuristics can be used successfully as auditing algorithms, and we exploit this in the development of our algorithmic results and their experimental evaluation.
We make the following mild assumption on the class of group indicators , to aid in our reductions. It is satisfied by most natural classes of functions, but is in any case essentially without loss of generality (since learning negated functions can be simulated by learning the original function class on a dataset with flipped class labels).
We assume the set of group indicators satisfies closure under negation: for any , we also have .
Recalling that and the following notions will be useful for describing our results:
and .
: the marginal distribution on .
: the conditional distribution on , conditioned on .
We give our reduction first for SP subgroup fairness. The reduction for FP subgroup fairness will follow as a corollary, since auditing for FP subgroup fairness can be viewed as auditing for statistical parity fairness on the subset of the data restricted to .
Fix any distribution , and any set of group indicators . Then for any , the following relationships hold:
We will prove Theorem 3.2 in two steps. First, we show that any unfair certificate for has non-trivial error for predicting the decision made by from the sensitive attributes.
In the first case, we know , and so . It follows that
In the second case, we have and . We can then bound
In both cases, we have by our assumption on the base rate. Since , we know
In the next step, we show that if there exists any function that accurately predicts the decisions made by the algorithm , then either or can serve as an unfairness certificate for .
Suppose that , then our claim holds with . Suppose not, then we must have
Note that by our assumption . This means
which implies that our claim holds with . ∎
In the reverse direction, consider the auditing problem on the classifier . We can treat each pair as a labelled example and learn a hypothesis in that approximates the decisions made by . Suppose that is -unfair. Then by Lemma 3.3, we know that there exists some such that . Therefore, the weak agnostic learning algorithm from the hypothesis of the theorem will return some with . By Lemma 3.4, we know or is a -unfair certificate for . ∎
2 False Positive Fairness
A corollary of the above reduction is an analogous equivalence between auditing for FP subgroup fairness and agnostic learning. This is because a FP fairness constraint can be viewed as a statistical parity fairness constraint on the subset of the data such that . Therefore, Theorem 3.2 implies the following:
Fix any distribution , and any set of group indicators . The following two relationships hold:
3 Worst-Case Intractability of Auditing
While we shall see in subsequent sections that the equivalence given above has positive algorithmic and experimental consequences, from a purely theoretical perspective the reduction of agnostic learning to auditing has strong negative worst-case implications. More precisely, we can import a long sequence of formal intractability results for agnostic learning to obtain:
Under standard complexity-theoretic intractability assumptions, for the classes of conjunctions of boolean attributes, linear threshold functions, or bounded-degree polynomial threshold functions, there exist distributions such that the auditing problem cannot be solved in polynomial time, for either statistical parity or false positive fairness.
The proof of this theorem follows from Theorem 3.2, Corollary 3.5, and the following negative results from the learning theory literature. Feldman et al. (2012) show a strong negative result for weak agnostic learning for conjunctions: given a distribution on labeled examples from the hypercube such that there exists a monomial (or conjunction) consistent with -fraction of the examples, it is NP-hard to find a halfspace that is correct on -fraction of the examples, for arbitrary constant . Diakonikolas et al. (2011) show that under the Unique Games Conjecture, no polynomial-time algorithm can find a degree- polynomial threshold function (PTF) that is consistent with fraction of a given set of labeled examples, even if there exists a degree- PTF that is consistent with a fraction of the examples. Diakonikolas et al. (2011) also show that it is NP-Hard to find a degree-2 PTF that is consistent with a fraction of a given set of labeled examples, even if there exists a halfspace (degree-1 PTF) that is consistent with a fraction of the examples.
While Theorem 3.6 shows that certain natural subgroup classes yield intractable auditing problems in the worst case, in the rest of the paper we demonstrate that effective heuristics for this problem on specific (non-worst case) distributions can be used to derive an effective and practical learning algorithm for subgroup fairness.
A Learning Algorithm Subject to Fairness Constraints 𝒢𝒢\mathcal{G}
In this section, we present an algorithm for training a (randomized) classifier that satisfies false-positive subgroup fairness simultaneously for all protected subgroups specified by a family of group indicator functions . All of our techniques also apply to a statistical parity or false negative rate constraint.
Let denote a set of labeled examples , and let denote the empirical distribution over this set of examples. Let be a hypothesis class defined over both the protected and unprotected attributes, and let be a collection of group indicators over the protected attributes. We assume that contains a constant classifier (which implies that there is at least one fair classifier to be found, for any distribution).
Our goal will be to find the distribution over classifiers from that minimizes classification error subject to the fairness constraint over . We will design an iterative algorithm that, when given access to a CSC oracle, computes an optimal randomized classifier in polynomial time.
Let denote a probability distribution over . Consider the following Fair ERM (Empirical Risk Minimization) problem:
where , and the quantities and are defined in Definition 2.3. We will write to denote the objective value at the optimum for the Fair ERM problem, that is the minimum error achieved by a -fair distribution over the class .
Observe that the optimization is feasible for any distribution : the constant classifiers that labels all points 1 or 0 satisfy all subgroup fairness constraints. At the moment, the number of decision variables and constraints may be infinite (if and are infinite hypothesis classes), but we will address this momentarily.
Our main theoretical result is an computationally efficient oracle-based algorithm for solving the Fair ERM problem.
Step 1: Fair ERM as LP. First, we rewrite the Fair ERM problem as a linear program with finitely many decision variables and constraints even when and are infinite. To do this, we take advantage of the fact that Sauer’s Lemma lets us bound the number of labellings that any hypothesis class of bounded VC dimension can induce on any fixed dataset. The LP has one variable for each of these possible labellings, rather than one variable for each hypothesis. Moreover, again by Sauer’s Lemma, we have one constraint for each of the finitely many possible subgroups induced by on the fixed dataset, rather than one for each of the (possibly infinitely many) subgroups definable over arbitrary datasets. This step is important — it will guarantee that strong duality holds.
Step 2: Formulation as Game. We then derive the partial Lagrangian of the LP, and note that computing an approximately optimal solution to this LP is equivalent to finding an approximate minmax solution for a corresponding zero-sum game, in which the payoff function is the value of the Lagrangian. The pure strategies of the primal or “Learner” player correspond to classifiers , and the pure strategies of the dual or “Auditor” player correspond to subgroups . Intuitively, the Learner is trying to minimize the sum of the prediction error and a fairness penalty term (given by the Lagrangian), and the Auditor is trying to penalize the fairness violation of the Learner by first identifying the subgroup with the greatest fairness violation and putting all the weight on the dual variable corresponding to this subgroup. In order to reason about convergence, we restrict the set of dual variables to lie in a bounded set: times the probability simplex. is a parameter that we have to set in the proof of our theorem to give the best theoretical guarantees — but it is also a parameter that we will vary in the experimental section.
Step 3: Best Responses as CSC. We observe that given a mixed strategy for the Auditor, the best response problem of the Learner corresponds to a CSC problem. Similarly, given a mixed strategy for the Learner, the best response problem of the Auditor corresponds to an auditing problem (which can be represented as a CSC problem). Hence, if we have oracles for solving CSC problems, we can compute best responses for both players, in response to arbitrary mixed strategies of their opponents.
Step 4: FTPL for No-Regret. Finally, we show that the ability to compute best responses for each player is sufficient to implement dynamics known to converge quickly to equilibrium in zero-sum games. Our algorithm has the Learner play Follow the Perturbed Leader (FTPL) Kalai and Vempala (2005), which is a no-regret algorithm, against an Auditor who at every round best responds to the learner’s mixed strategy. By the seminal result of Freund and Schapire (1996), the average plays of both players converge to an approximate equilibrium. In order to implement this in polynomial time, we need to represent the loss of the learner as a low-dimensional linear optimization problem. To do so, we first define an appropriately translated CSC problem for any mixed strategy by the Auditor, and cast it as a linear optimization problem.
1 Rewriting the Fair ERM Problem
To rewrite the Fair ERM problem, we note that even though both and can be infinite sets, the sets of possible labellings on the data set induced by these classes are finite. More formally, we will write and to denote the set of all labellings on that are induced by and respectively, that is
We can bound the cardinalities of and using Sauer’s Lemma.
Given this observation, we can then consider an equivalent optimization problem where the distribution is over the set of labellings in , and the set of subgroups are defined by the labellings in . We will view each in as a Boolean function.
To simplify notations, we will define the following “fairness violation” functions for any and any :
Moreover, for any distribution over , for any sign
For any , , and any ,
Thus, we will focus on the following equivalent optimization problem.
For each pair of constraints (7) and (8), corresponding to a group , we introduce a pair of dual variables and . The partial Lagrangian of the linear program is the following:
By Sion’s minmax theorem (Sion, 1958), we have
where denotes the optimal objective value in the fair ERM problem. Similarly, the distribution corresponds to an optimal feasible solution to the fair ERM linear program. Thus, finding an optimal solution for the fair ERM problem reduces to computing a minmax solution for the Lagrangian. Our algorithms will both compute such a minmax solution by iteratively optimizing over both the primal variables and dual variables . In order to guarantee convergence in our optimization, we will restrict the dual space to the following bounded set:
where will be a parameter of our algorithm. Since is a compact and convex set, the minmax condition continues to hold (Sion, 1958):
Let be a -approximate minmax solution to the -bounded Lagrangian problem in the sense that
Then and for any ,
2 Zero-Sum Game Formulation
To compute an approximate minmax solution, we will first view Equation 9 as the following two player zero-sum matrix game. The Learner (or the minimization player) has pure strategies corresponding to , and the Auditor (or the maximization player) has pure strategies corresponding to the set of vertices in — more precisely, each vertex or pure strategy either is the all zero vector or consists of a choice of a , along with the sign or that the corresponding -fairness constraint will have in the Lagrangian. More formally, we write
Even though the number of pure strategies scales linearly with , our algorithm will never need to actually represent such vectors explicitly. Note that any vector in can be written as a convex combination of the maximization player’s pure strategies, or in other words: as a mixed strategy for the Auditor. For any pair of actions , the payoff is defined as
Let and such that is a -approximate minmax equilibrium in the zero-sum game defined above. Then is also a -approximate minmax solution for Equation 9.
Our problem reduces to finding an approximate equilibrium for this game. A key step in our solution is the ability to compute best responses for both players in the game, which we now show can be solved by the cost-sensitive classication (CSC) oracles.
Fix any mixed strategy (dual solution) of the Auditor. The Learner’s best response is given by:
Note that it suffices for the Learner to optimize over deterministic classifiers , rather than distributions over classifiers. This is because the Learner is solving a linear optimization problem over the simplex, and so always has an optimal solution at a vertex (i.e. a single classifier ). We can reduce this problem to one that can be solved with a single call to a CSC oracle. In particular, we can assign costs to each example as follows:
if , then and ;
Auditor’s best response as CSC.
Fix any mixed strategy (primal solution) of the Learner. The Auditor’s best response is given by:
Fix any such that that . Let be vector with one non-zero coordinate , where
Then .
if , then and ;
3 Solving the Game with No-Regret Dynamics
To compute an approximate equilibrium of the zero-sum game, we will simulate the following no-regret dynamics between the Learner and the Auditor over rounds: over each of the rounds, the Learner plays a distribution over the hypothesis class according to a no-regret learning algorithm (Follow the Perturbed Leader), and the Auditor plays an approximate best response against the Learner’s distribution for that round. By the result of Freund and Schapire (1996), the average plays of both players over time converge to an approximate equilibrium of the game, as long as the Learner has low regret.
Let be a sequence of distributions played by the Learner, and let be the Auditor’s sequence of approximate best responses against these distributions respectively. Let and be the two players’ empirical distributions over their strategies. Suppose that the regret of the Learner satisfies
Then is an -approximate minimax equilibrium of the game.
To run the FTPL algorithm, the Learner will optimize a “perturbed” version of the problem above. In particular, the Learner will play a distribution over the hypothesis class that is implicitely defined by the following sampling operation. To sample a hypothesis from , the learner solves the following randomized optimization problem:
where is a parameter and is a noise vector drawn from the uniform distribution over . Note that while it is intractable to explicitly represent the distribution (which has support size scaling with ), we can sample from efficiently given access to a cost-sensitive classification oracle for . By instantiating the standard regret bound of FTPL for online linear optimization (Theorem 2.9), we get the following regret bound for the Learner.
Let be the time horizon for the no-regret dynamics. Let be the sequence of distributions maintained by the Learner’s FTPL algorithm with , and be the sequence of plays by the Auditor. Then
Now we consider how the Auditor (approximately) best responds to the distribution . The main obstacle is that we do not have an explicit representation for . Thus, our first step is to approximate with an explicitly represented sparse distribution . We do that by drawing i.i.d. samples from , and taking the empirical distribution over the sample. The Auditor will best respond to this empirical distribution . To show that any best response to is also an approximate best response to , we will rely on the following uniform convergence lemma, which bounds the difference in expected payoff for any strategy of the auditor, when played against as compared to .
Fix any and any distribution over . Let be i.i.d. draws from , and be the empirical distribution over the realized sample. Then with probability at least over the random draws of ’s, the following holds,
Using Lemma 4.11, we can derive a regret bound for the Auditor in the no-regret dynamics.
Let be the time horizon for the no-regret dynamics. Let be the sequence of distributions maintained by the Learner’s FTPL algorithm. For each , let be the empirical distribution over i.i.d. draws from . Let be the Auditor’s best responses against . Then with probability ,
Finally, let and be the average of the strategies played by the two players over the course of the dynamics. Note that is an average of many distributions with large support, and so itself has support size that is too large to represent explicitely. Thus, we will again approximate with a sparse distribution estimated from a sample drawn from . Note that we can efficiently sample from given access to a CSC oracle. To sample, we first uniformly randomly select a round , and then use the CSC oracle to solve the sampling problem defined in (14), with the noise random variable freshly sampled from its distribution. The full algorithm is described in Algorithm 2 and we present the proof for Theorem 4.2 below.
By Theorem 4.5, it suffices to show that with probability at least , is a -approximate equilibrium in the zero-sum game. As a first step, we will rely on Theorem 4.9 to show that forms an approximate equilibrium.
By Lemma 4.10, the regret of the sequence is bounded by:
By Lemma 4.12, with probability , we have
We will condition on this upper-bound event on for the rest of this proof, which is the case except with probability . By Theorem 4.9, we know that the average plays form an -approximate equilibrium.
Finally, we need to bound the additional error for outputting the sparse approximation instead of . We can directly apply Lemma 4.11, which implies that except with probability , the pair form a -approximate equilibrium, with
Note that as long as we have ,
Experimental Evaluation
We now describe an experimental evaluation of our proposed algorithmic framework on a dataset in which fairness is a concern, due to the preponderance of racial and other sensitive features. For far more detailed experiments on four real datasets investigating the convergence properties of our algorithm, evaluating its accuracy vs. fairness tradeoffs, and comparing our approach to the recent algorithm of Agarwal et al. (2017), we direct the reader to Kearns et al. (2018). Python code and an illustrative Jupyter notebook are provided here (https://github.com/algowatchpenn/GerryFair).
While the no-regret-based algorithm described in the last section enjoys provably polynomial time convergence, for the experiments we instead implemented a simpler yet effective algorithm based on Fictitious Play dynamics. We first describe and discuss this modified algorithm.
Like the algorithm given in the last section, the algorithm we implemented works by simulating a game dynamic that converges to Nash equilibrium in the zero-sum game that we derived, corresponding to the Fair ERM problem. Rather than using a no-regret dynamic, we instead use a simple iterative procedure known as Fictitious Play (Brown, 1949). Fictitious Play dynamics has the benefit of being more practical to implement: at each round, both players simply need to compute a single best response to the empirical play of their opponents, and this optimization requires only a single call to a CSC oracle. In contrast, the FTPL dynamic we gave in the previous section requires making many calls to a CSC oracle per round — a computationally expensive process — in order to find a sparse approximation to the Learner’s mixed strategy at that round. Fictitious Play also has the benefit of being deterministic, unlike the randomized sampling required in the FTPL no-regret dynamic, thus eliminating a source of experimental variance.
The disadvantage is that Fictitious Play is only known to converge to equilibrium in the limit Robinson (1951), rather than in a polynomial number of rounds (though it is conjectured to converge quickly under rather general circumstances; see Daskalakis and Pan (2014) for a recent discussion). Nevertheless, this is the algorithm that we use in our experiments — and as we will show, it performs well on real data, despite the fact that it has weaker theoretical guarantees compared to the algorithm we presented in the last section.
Fictitious play proceeds in rounds, and in every round each player chooses a best response to his opponent’s empirical history of play across previous rounds, by treating it as the mixed strategy that randomizes uniformly over the empirical history. Pseudocode for the implemented algorithm is given below.
2 Description of Data
The dataset we use for our experimental valuation is known as the “Communities and Crime” (C&C) dataset, available at the UC Irvine Data Repositoryhttp://archive.ics.uci.edu/ml/datasets/Communities+and+Crime. Each record in this dataset describes the aggregate demographic properties of a different U.S. community; the data combines socio-economic data from the 1990 US Census, law enforcement data from the 1990 US LEMAS survey, and crime data from the 1995 FBI UCR. The total number of records is 1994, and the number of features is 122. The variable to be predicted is the rate of violent crime in the community.
While there are larger and more recent datasets in which subgroup fairness is a potential concern, there are properties of the C&C dataset that make it particularly appealing for the initial experimental evaluation of our proposed algorithm. Foremost among these is the relatively high number of sensitive or protected attributes, and the fact that they are real-valued (since they represent aggregates in a community rather than specific individuals). This means there is a very large number of protected sub-groups that can be defined over them. There are distinct continuous features measuring the percentage or per-capita representation of multiple racial groups (including white, black, Hispanic, and Asian) in the community, each of which can vary independently of the others. Similarly, there are continuous features measuring the average per capita incomes of different racial groups in the community, as well as features measuring the percentage of each community’s police force that falls in each of the racial groups. Thus restricting to features capturing race statistics and a couple of related ones (such as the percentage of residents who do not speak English well), we obtain an 18-dimensional space of real-valued protected attributes. We note that the C&C dataset has numerous other features that arguably could or should be protected as well (such as gender features), which would raise the dimensionality of the protected subgroups even further. Ongoing experiments on other datasets where fairness is a concern will be reported on in a forthcoming experimental paper.
We convert the real-valued rate of violent crime in each community to a binary label indicating whether the community is in the 70th percentile of that value, indicating that it is a relatively high-crime community. Thus the strawman baseline that always predicts 0 (lower crime) has error approximately 30% or 0.3 on this classification problem. We chose the 70th percentile since it seems most natural to predict the highest crime rates.
As in the theoretical sections of the paper, our main interest and emphasis is on the effectiveness of our proposed algorithm FairFictPlay on a given dataset, including:
Whether the algorithm in fact converges, and does so in a feasible amount of computation. Recall that formal convergence is only guaranteed under the assumption of oracles that do not exist in practice, and even then is only guaranteed asymptotically.
Whether the classifier learned by the algorithm has nontrivial accuracy, as well as strong subgroup fairness properties.
Whether the algorithm and dataset permits nontrivial tuning of the trade-off between accuracy and subgroup fairness.
As discussed in Section 2.1, we note that all of these issues can be investigated entirely in-sample, without concern for generalization performance. Thus for simplicity, despite the fact that our algorithm enjoys all the usual generalization properties depending on the VC dimension of the Learner’s hypothesis space and the Auditor’s subgroup space (see Theorems 2.12 and 2.11), we report all results here on the full C&C dataset of 1994 points, treating it as the true distribution of interest.
3 Algorithm Implementation
The main details in the implementation of FairFictPlay are the identification of the model classes for Learner and Auditor, the implementation of the cost sensitive classification oracle and auditing oracle, and the identification of the protected features for Auditor. For our experiments, at each round Learner chooses a linear threshold function over all 122 features. We implement the cost sensitive classification oracle via a two stage regression procedure. In particular, the inputs to the cost sensitive classification oracle are cost vectors , where the element of is the cost of predicting on datapoint . We train two linear regression models to predict and respectively, using all features. Given a new point , we predict the cost of classifying as and using our regression models: these predictions are and respectively. Finally we output the prediction corresponding to lower predicted cost: .
Auditor’s model class consists of all linear threshold functions over just the 18 aforementioned protected race-based attributes. As per the algorithm, at each iteration Auditor attempts to find a subgroup on which the false positive rate is substantially different than the base rate, given the Learner’s randomized classifier so far. We implement the auditing oracle by treating it as a weighted regression problem in which the goal is find a linear function (which will be taken to define the subgroup) that on the negative examples, can predict the Learner’s probabilistic classification on each point. We use the same regression subroutine as Learner does, except that Auditor only has access to the sensitive features, rather than all .
Recall that in addition to the choices of protected attributes and model classes for Learner and Auditor, FairFictPlay has a parameter , which is a bound on the norm of the dual variables for Auditor (the dual player). While the theory does not provide an explicit bound or guide for choosing , it needs to be large enough to permit the dual player to force the minmax value of the game. For our experiments we chose , which despite being a relatively small value seems to suffice for (approximate) convergence.
The other and more meaningful parameter of the algorithm is the bound in the Fair ERM optimization problem implemented by the game, which controls the amount of unfairness permitted. If on a given round the subgroup disparity found by the Auditor is greater than , the Learner must react by adding a fairness penalty for this subgroup to its objective function; if it is smaller than , the Learner can ignore it and continue to optimize its previous objective function. Ideally, and as we shall see, varying allows us to trace out a menu of trade-offs between accuracy and fairness.
4 Results
Particularly in light of the gaps between the idealized theory and the actual implementation, the most basic questions about FairFictPlay are whether it converges at all, and if so, whether it converges to “interesting” models — that is, models with both nontrivial classification error (much better than the 30% or 0.3 baserate), and nontrivial subgroup fairness (much better than ignoring fairness altogether). We shall see that at least for the C&C dataset, the answers to these questions is strongly affirmative.
We begin by examining the evolution of the error and unfairness of Learner’s model. In the left panel of Figure 1 we show the error of the model found by Learner vs. iteration for values of ranging from 0 to 0.029. Several comments are in order.
First, after an initial period in which there is a fair amount of oscillatory behavior, by 6000 iterations most of the curves have largely flattened out, and by 8,000 iterations it appears most but not all have reached approximate convergence. Second, while the top-to-bottom ordering of these error curves is approximately aligned with decreasing — so larger generally results in lower error, as expected — there are many violations of this for small , and even a few at large . Third, and as we will examine more closely shortly, the converged values at large do indeed exhibit a range of errors.
In the right panel of Figure 1, we show the corresponding unfairness of the subgroup found by the Auditor at each iteration for the same runs and values of the parameter (indicated by horizontal dashed lines), with the same color-coding as for the left panel. Now the ordering is generally reversed — larger values of generally lead to higher curves, since the fairness constraint on the Learner is weaker. We again see a great deal of early oscillatory behavior, with most curves then eventually settling at or near their corresponding input value, as Learner and Auditor engage in a back-and-forth struggle for lower error for Learner and -subgroup fairness for Auditor.
For any choice of the parameter , and each iteration , the two panels of Figure 1 yield a pair of realized values from the experiment, corresponding to a Learner model whose error is , and for which the worst subgroup the Auditor was able to find had unfairness . The set of all pairs across all runs or values thus represents the different trade-offs between error and unfairness found by our algorithm on the data. Most of these pairs are of course Pareto-dominated by other pairs, so we are primarily interested in the undominated frontier.
In the left panel of Figure 2, for each value of we show the Pareto-optimal pairs, color-coded for the value of . Each value of yields a set or cloud of undominated pairs that are usually fairly close to each other, and as expected, as is increased, these clouds generally move leftwards and upwards (lower error and higher unfairness).
We anticipate that the practical use of our algorithm would, as we have done, explore many values of and then pick a model corresponding to a point on the aggregated Pareto frontier across all , which represents the collection of all undominated models and the overall error-unfairness trade-off. This aggregate frontier is shown in the right panel of Figure 2, and shows a relatively smooth menu of options, ranging from error about 0.21 and no unfairness at one extreme, to error about 0.12 and unfairness 0.025 at the other, and an appealing assortment of intermediate trade-offs. Of course, in a real application the selection of a particular point on the frontier should be made in a domain-specific manner by the stakeholders or policymakers in question.
We thank Alekh Agarwal, Richard Berk, Miro Dudík, Akshay Krishnamurthy, John Langford, Greg Ridgeway and Greg Yang for helpful discussions and suggestions.
References
Appendix A Chernoff-Hoeffding Bound
We use the following concentration inequality.
Appendix B Generalization Bounds
We give a proof of Theorem 2.11. The proof of Theorem 2.12 is identical, as false positive rates are just positive classification rates on the subset of the data for which .
Given a set of classifiers and protected groups , define the following function class:
We can relate the VC-dimension of to the VC-dimension of and :
This bound, together with a standard VC-Dimension based uniform convergence theorem (see e.g. Kearns and Vazirani ) implies that with probability , for every :
Note that the left hand side of the above inequality can be written as:
Appendix C Missing Proofs in Section 4
Let be the optimal feasible solution for our constrained optimization problem. Since is feasible, we know that .
We will first focus on the case where is not a feasible solution, that is
Note that , and so
Note that , so we must have . Furthermore, since , we know
which implies that maximum constraint violation satisfies . By applying 4.4, we get
Now let us consider the case in which is a feasible solution for the optimization problem. Then it follows that there is no constraint violation by and , and so
Therefore, the stated bounds hold for both cases. ∎
Also note that the dimension of the optimization is the size of the dataset . This means if we set , the regret of the learner will then be bounded by . ∎
Recall that for any distribution over the expected payoff function is defined as
The first part follows directly from a simple application of the Chernoff-Hoeffding bound (Theorem A.1): with probability , , as long as .
To bound the second part, we first note that by Hölder’s inequality, we have
Since for all we have , it suffices to show that with probability , holds for all and . Note that
We can rewrite the absolute value of first term:
where the last inequality follows from .
In the following, we will let . Similarly, we also have for each ,
By taking the union bound over (17) and (18) over all choices of , we have with probability at least ,
Note that by Sauer’s lemma (Lemma 4.3), . Thus, there exists an absolute constant such that implies that failure probability above . We will assume satisifies such a bound, and so the events of (19) and (20) hold with probaility at least . Then by the triangle inequality we have for all , , which implies that . This completes the proof. ∎
Suppose there are two distributions and over such that
By instantiating Lemma 4.11 and applying union bound across all steps, we know with probability at least , the following holds for all :
Note that by C.1, the Auditor is performing a -approximate best response at each round . Then we can bound the Auditor’s regret as follows:
It follows that with probability , we have