-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalgo-fairness-part1.html
688 lines (560 loc) · 20.2 KB
/
algo-fairness-part1.html
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Algorithmic fairness — Part 1</title>
<link rel="stylesheet" href="dist/reset.css">
<link rel="stylesheet" href="dist/reveal.css">
<link rel="stylesheet" href="custom_themes/sussex.css" id="theme">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="plugin/highlight/monokai.css">
</head>
<body>
<div id="hidden" style="display:none;"><div id="static-content">
<footer>
<p>Topics in Computer Science</p>
</footer>
</div> </div>
<div class="reveal"><div class="slides">
<section>
<h1>Algorithmic fairness</h1>
<p>by Oliver Thomas and Thomas Kehrenberg</p>
<img src="images/sussex_logo.svg" style="width: 15%; border: none;"/>
</section>
<section>
<h2>Machine Learning</h2>
<blockquote>...using statistical techniques to give computer systems the ability to "learn"
(e.g., progressively improve performance on a specific task)
from data, without being explicitly programmed.
</blockquote>
</section>
<section data-markdown><textarea data-template>
## Classification
- given some input $X$, predict a class label $Y \in \\{0, 1, ..., C-1\\}$
- $X$ is usually a **vector**
- often with high number of dimensions, e.g. more than 1 million for a picture
- simplest case: **binary classification**, $Y \in \\{0, 1\\}$
- for example: is there a hot dog in this picture ($Y=1$) or not ($Y=0$)?
</textarea></section>
<section data-markdown><textarea data-template>
## Classification
- we are looking to train a function $f$ that maps $X$ to $Y$
- the output is the prediction: $\hat{Y} = f(X)$
- we want $\hat{Y}$ to be as close as possible to the label $Y$
- $f$ can be implemented as
- a neural network
- an SVM
- a logistic regression model
</textarea></section>
<section data-markdown><textarea data-template>
## Training data
- training data: a set of pairs $(x, y)$
- input data $x$ with corresponding label $y$
- we are looking for model that works well on the training data
- if we make predictions on data that is *very different* from the training data,
the model will perform badly
- problem if the training data does not describe reality well
</textarea></section>
<section data-markdown><textarea data-template>
## Where is machine learning used?
- hiring decisions
- bail decisions
- credit approval
- insurance premiums
<aside class="notes">
Companies are already using or planning to use machine learning for these tasks.
</aside>
</textarea></section>
<section>
<p> </p>
<p> </p>
<p> </p>
But there are problems:
</section>
<section>
<img class="stretch" src="images/pp_mb.png" title="Pro-Publica - Machine Bias"/>
</section>
<section>
<img class="stretch" src="images/amazon.png" title="Amazon CV Screening"/>
</section>
<section data-markdown><textarea data-template>
## Algorithmic bias
- machine learning systems are making decisions that affect humans
- these decisions should be *fair*
- by default machine learning algorithms tend to be biased in some way
- why?
</textarea></section>
<section data-markdown><textarea data-template>
## Algorithmic bias
The problem can be divided into <ins>two categories</ins>. Both types of bias can appear together.
- bias stemming from biased training data
- bias stemming from the algorithms themselves
</textarea></section>
<section>
<p> </p>
<p> </p>
<h1>Biased training data</h1>
</section>
<section data-markdown><textarea data-template>
## Bias in, bias out
- Databases: GIGO
- ML: BIBO
- the ML algorithm just learns what is in the training data
</textarea></section>
<section data-markdown><textarea data-template>
## Examples for bias
**Task**: generate description for images
![](./images/women_also_snowboard/title.png)
</textarea></section>
<section>
<img class="stretch" src="images/women_also_snowboard/example1.png" title="Women also Snowboard, 1"/>
</section>
<section data-markdown><textarea data-template>
## Learning wrong features
The algorithm predicts the gender from the activity and not from looking at the person.
![](./images/women_also_snowboard/example2.png)
</textarea></section>
<section data-markdown><textarea data-template>
## Desired result
- what we would want is that the algorithm only looks at the person when predicting the gender
- if the gender is not recognizable from the picture, the algorithm should be "unsure"
</textarea></section>
<section data-markdown><textarea data-template>
## Biased data
- in the previous example, certain training examples were underrepresented
- sampling bias
- other case: data is simply wrong
- e.g. data was gathered by humans who just lied
</textarea></section>
<section data-markdown><textarea data-template>
## Enforcing a fair outcome
- no matter in what way the data is biased: we want to **enforce a fair outcome**
- idea: just tell the algorithm that it should treat all groups in the same way
- question: **how do we define a fair outcome?**
- really hard question
- start with the simplest definition
</textarea></section>
<section data-markdown><textarea data-template>
## Example
- task: predict whether someone should be hired ($Y=1$) or not ($Y=0$)
- two races: <span style="color: blue">blue race</span> and <span style="color: green">green race</span>
- blue: $S=0$, green: $S=1$
- in the training set: **20% of blue** applicants were hired, **50% of green** applicants were hired
</textarea></section>
<section data-markdown><textarea data-template>
## Statistical parity
$$
P(\hat{Y}=1 | S=0) = P(\hat{Y}=1 | S=1)
$$
- $\hat{Y} \in \\{0,1\\}, S \in \\{0,1\\}$
- $S$: sensitive attribute (for example gender, race)
- $\hat{Y}$: prediction
**meaning**: the probability to get a positive prediction is the same for each group
</textarea></section>
<section data-markdown><textarea data-template>
## Statistical parity
- concrete: when evaluating the algorithm on the test set, both groups ($S=0$ and $S=1$)
should have the same number of positive predictions ($\hat{Y}=1$)
- in the hiring example from before: same percentage from both races will be hired (e.g. 30%)
</textarea></section>
<section data-markdown><textarea data-template>
## Side effects of statistical parity
- enforcing statistical parity necessarily produces **lower accuracy**
- consider this: we want to enforce 30% acceptance for the blue race but the training data only has 20% accepted
- some individuals of the blue race have to be "misclassified" ($\hat{Y} = 1$ instead of $\hat{Y} = 0$)
to make the numbers work
- not surprising because we are computing accuracy against the *biased data*
</textarea></section>
<section data-markdown><textarea data-template>
## Trade-off: Fairness – Accuracy
- usually we don't want to have too bad accuracy with respect to the (bias) data
- goal: find algorithm that produces fair result at highest possible accuracy
- otherwise it's easy: a *random classifier* is very fair (but useless)
- random classifier: just predict $\hat{Y} = 1$ 50% of the time regardless of input
</textarea></section>
<section data-markdown><textarea data-template>
## Summary of Statistical Parity
- very simple criterion
- introduces Fairness – Accuracy trade-off
- more sophisticated criteria are possible (based on causal graphs)
</textarea></section>
<section>
<p> </p>
<h1>Bias introduced by the ML algorithm</h1>
</section>
<section data-markdown><textarea data-template>
## Why would an ML algorithm introduce bias?
Consider again the hiring example:
- two features: SAT score and race (blue and green) of individuals
- task: predict if they should be hired ($Y=1$) or not ($Y=0$)
- composition of the dataset: 50% blue, 50% green. 20% of blue have $Y=1$, 50% of green have $Y=1$.
</textarea></section>
<section data-markdown><textarea data-template>
## Bias from algorithm
The dataset is heavily skewed but let's ignore that for now and just try to make accurate predictions for this dataset.
</textarea></section>
<section data-markdown><textarea data-template>
## Bias from algorithm
(Reminder: 20% of blue have $Y=1$, 50% of green have $Y=1$.)
A simple way to make relatively accurate predictions:
- for green individuals base the prediction on SAT
- for blue individuals ignore SAT score and always predict $Y=0$
Result: up to 90% accuracy (80% in blue subgroup and 100% in green subgroup)
</textarea></section>
<section data-markdown><textarea data-template>
## Bias from algorithm
- the dataset was already skewed but the algorithm's prediction are even more "unfair"
- this is because it's easier to just base the decision on race than to figure out the effect of the SAT
- this is an extreme case but similar things can actually happen
</textarea></section>
<section data-markdown><textarea data-template>
## Bias from algorithm
**What we do not want:** the algorithm "being lazy" in a subgroup
**What we want:** the algorithm should make equally good predictions for all subgroups
Criterion that enforces this: *Equality of Opportunity*
</textarea></section>
<section data-markdown><textarea data-template>
## Equality of Opportunity
$$
P(\hat{Y}=1 | S=0, Y=1) = P(\hat{Y}=1 | S=1, Y=1)
$$
- with $Y, \hat{Y} \in \\{0,1\\}$ and $S \in \\{0,1\\}$
**meaning**: the probability of predicting 1, given that the label is 1, should be the same for all groups
**in practice**: the TPR (true positive rate) should be the same in all groups
</textarea></section>
<section data-markdown><textarea data-template>
## Equalised Odds
$$
P(\hat{Y}=y | S=0, Y=y) = P(\hat{Y}=y | S=1, Y=y)
$$
for all possible values for $y$
- stricter version of *Equality of Opportunity*
- TPR and TNR (true negative rate) must be the same in all groups
- TPR = TP / (TP + FN), TNR = TN / (TN + FP)
</textarea></section>
<section data-markdown><textarea data-template>
## Properties
- **EoO** (Equality of Opportunity) and **EO** (Equalised Odds) both assume that the training data is correct
- a perfect classifier (that always predicts the correct label) fulfills **EoO** and **EO**d
- however: a random classifier does as well
- a random classifier achieves 50% TPR (and TNR) in all groups
</textarea></section>
<section data-markdown><textarea data-template>
## Accuracy–Fairness trade-off
- achieving EoO or EO at low accuracy is easy (see random classifier)
- here, even more than for Statistical Parity, it is important to find an algorithm with good fairness and good accuracy
</textarea></section>
<!-- Border between Thomas stuff and Oliver stuff -->
<section>
<section data-markdown><textarea data-template>
## All statistics-based Fairness Criteria
- Statistical Parity
- Equalised Odds
- Equality of Opportunity
- Calibration by Group
</textarea></section>
<section data-markdown><textarea data-template>
## Statistical Parity
#### (**independence** based notion of fairness)
$$
P(\hat{Y}=1 | S=0) = P(\hat{Y}=1 | S=1)
$$
$$
Y \in \\{0,1\\} \\\\
S \in \\{0,1\\}
$$
</textarea></section>
<section data-markdown><textarea data-template>
## Equalised Odds
#### (**separation** based notion of fairness)
$$
P(\hat{Y}=1 | S=0, Y=y) = P(\hat{Y}=1 | S=1, Y=y)
$$
$$
Y \in \\{0,1\\} \\\\
S \in \\{0,1\\}
$$
</textarea></section>
<section data-markdown><textarea data-template>
## Equality of Opportunity
#### (**separation** based notion of fairness)
$$
P(\hat{Y}=1 | S=0, Y=1) = P(\hat{Y}=1 | S=1, Y=1)
$$
$$
Y \in \\{0,1\\} \\\\
S \in \\{0,1\\}
$$
</textarea></section>
<section data-markdown><textarea data-template>
## Calibration by Group
#### (**sufficiency** based notion of fairness)
$$
P(Y=1 | \hat{Y}=\hat{y}, S=s) = \hat{y}
$$
$$
\hat{Y} \in \[0...1\] \\\\
S \in \\{0,1\\}
$$
</textarea></section>
</section>
<section>
<p> </p>
<p><strong>Let's have all the fairness!</strong></p>
<p>If we are fair with regards to all notions of fair, then we're fair... right?</p>
</section>
<section>
<p>Independence based fairness (i.e. Statistical Parity)</p>
$$
\hat{Y} \perp S
$$
<p>Separation based fairness (i.e. Equalised Odds/Opportunity)</p>
$$
\hat{Y} \perp S | Y
$$
<p>For both to hold, then either $S \perp Y$, our data is fair, or $\hat{Y} \perp Y$, we have a random predictor.</p>
<p>Similarly, Sufficiency cannot hold with either notion of fairness.</p>
</section>
<section>
<h2>So which fairness criteria should we use?</h2>
<p>Consider a university, and we are in charge of administration!</p>
<p>We can only accept 50% of all applicants.</p>
<p>10,000 applicants are female and 10,000 of applicants are male.</p>
<p>We have been tasked with being fair with regard to <b>gender</b>.</p>
</section>
<section>
<p>We have an acceptance criteria that is highly predictive of success.</p>
<p>80% of those who meet the acceptance criteria will successfully graduate.</p>
<p>Only 10% of those who don't meet the acceptance criteria will successfully graduate.</p>
</section>
<section>
<p>As we're a good university we have a lot of applications from people who don't meet the acceptance criteria.</p>
<p>60% of female applicants meet the acceptance criteria.</p>
<p>40% of male applicants meet the acceptance criteria.</p>
<p>Remember, we can only accept 50% of all applicants</p>
<h3>What should we do?</h3>
</section>
<section>
<h3>Truth Tables</h3>
<h4>Female Applicants</h4>
<table>
<thead><tr>
<th></th>
<th>Accepted</th>
<th>Not</th>
</tr></thead>
<tbody><tr>
<td>Actually Graduate</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Don't Graduate</td>
<td></td>
<td></td>
</tr></tbody>
</table>
<h4>Male Applicants</h4>
<table>
<thead><tr>
<th></th>
<th>Accepted</th>
<th>Not</th>
</tr></thead>
<tbody><tr>
<td>Actually Graduate</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Don't Graduate</td>
<td></td>
<td></td>
</tr></tbody>
</table>
</section>
<section>
<p>How would we solve this problem being fair using Statistical Parity as our measure?</p>
<section>???</section>
<section>Select 50% of applicants of both female and male applicants</section>
<section>
<h4>Female Applicants</h4>
<table>
<thead><tr>
<th></th>
<th>Accepted</th>
<th>Not</th>
</tr></thead>
<tbody><tr>
<td>Actually Graduate</td>
<td>4000</td>
<td>1200</td>
</tr>
<tr>
<td>Don't Graduate</td>
<td>1000</td>
<td>3800</td>
</tr></tbody>
</table>
<h4>Male Applicants</h4>
<table>
<thead><tr>
<th></th>
<th>Accepted</th>
<th>Not</th>
</tr></thead>
<tbody><tr>
<td>Actually Graduate</td>
<td>3300</td>
<td>500</td>
</tr>
<tr>
<td>Don't Graduate</td>
<td>1700</td>
<td>4500</td>
</tr></tbody>
</table>
</section>
<section>10% of qualified female applicants are being rejected whilst an additional 10% of unqualified males are being accepted.</section>
</section>
<section>
<p>How would we solve this problem being fair using Equal Opportunity as our measure?</p>
<section>???</section>
<section>Select 55.5% of female applicants and 44.5% of male applicants, giving a TPR of 85.4% for both groups.</section>
<section>
<h4>Female Applicants</h4>
<table>
<thead><tr>
<th></th>
<th>Accepted</th>
<th>Not</th>
</tr></thead>
<tbody><tr>
<td>Actually Graduate</td>
<td>4440</td>
<td>760</td>
</tr>
<tr>
<td>Don't Graduate</td>
<td>1110</td>
<td>3690</td>
</tr></tbody>
</table>
<h4>Male Applicants</h4>
<table>
<thead><tr>
<th></th>
<th>Accepted</th>
<th>Not</th>
</tr></thead>
<tbody><tr>
<td>Actually Graduate</td>
<td>3245</td>
<td>555</td>
</tr>
<tr>
<td>Don't Graduate</td>
<td>1205</td>
<td>4995</td>
</tr></tbody>
</table>
</section>
<section>Similar situation to Statistical Parity</section>
</section>
<section>
<p>How would we solve this problem being fair using Calibration by Group as our measure?</p>
<section>???</section>
<section>Select only the applicants who meet the acceptance criteria.</section>
<section>
<h4>Female Applicants</h4>
<table>
<thead><tr>
<th></th>
<th>Accepted</th>
<th>Not</th>
</tr></thead>
<tbody><tr>
<td>Actually Graduate</td>
<td>4800</td>
<td>400</td>
</tr>
<tr>
<td>Don't Graduate</td>
<td>1200</td>
<td>3600</td>
</tr></tbody>
</table>
<h4>Male Applicants</h4>
<table>
<thead><tr>
<th></th>
<th>Accepted</th>
<th>Not</th>
</tr></thead>
<tbody><tr>
<td>Actually Graduate</td>
<td>3200</td>
<td>600</td>
</tr>
<tr>
<td>Don't Graduate</td>
<td>800</td>
<td>5400</td>
</tr></tbody>
</table>
</section>
<section>Could lead to systemic reinforcement of bias.</section>
</section>
<section>
<h2>Which fairness criteria should we use?</h2>
<p>There's no right answer, all the above are "fair". It's important to consult domain experts to find which is the best fit for each problem. There is no one-size fits all.</p>
</section>
<section data-markdown><textarea data-template>
## How to enforce fairness?
Fairness constraints can be added pre, during or post training.
Pre-training examples
- Zemel Fair Representations
- Beutel Adversarial Representation
- Quadrianto Fair Interpretable Representations
- Feldman
</textarea></section>
<section data-markdown><textarea data-template>
During Training
- Zafar's methods
- Zhang
- Kehrenberg Fair GP
Post Training
- Hardt Recalibrating
</textarea></section>
<section data-markdown><textarea data-template>
More on those next week...
</textarea></section>
<section data-markdown><textarea data-template>
Popular approach is to add produce a "fair" representation. Consider that we have 2 roles, a data vendor, who is charge of collecting the data and preparing it. Our other role is a data user, someone who will be making predictions based on our data.
The data vendor is concerned that the data user may be using their data to make unfair decisions. So the data vendor decides to learn a new, fair representation.
</textarea></section>
<section data-markdown><textarea data-template>
The state-of-the-art method a fair representation this is to use an *adversarial* network, using a "Gradient-Reversal Layer" from Ganin et al.
![](./images/adversarial.svg)
</textarea></section>
<section>
<section>
<h2>Problems with doing this?</h2>
<h4>Any Ideas?</h4>
</section>
<section>
<h2>Problems with doing this?</h2>
<h4>What does this representation mean?</h4>
<p>The learned representation is uninterpretable by default. Recently Quadrianto et al constrained the representation to be in the same same as the input so that we could look at what changed</p>
</section>
<section>
<h2>Problems with doing this?</h2>
<h4>What if the vendor data user decides to be fair as well?</h4>
<p>Referred to as "fair pipelines". Work has only just begun exploring these. Current research shows that these don't work (at the moment!)</p>
</section>
</section>
</div></div>
<script type="module" src="settings.js"></script>
</body>
</html>