Skip to content

Commit 46978bf

Browse files
authored
Merge pull request #2 from pat-alt/endogenous
Endogenous
2 parents 0abc127 + 1383963 commit 46978bf

14 files changed

+322
-300
lines changed

.DS_Store

8 KB
Binary file not shown.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# ----------------------------------- Extra -----------------------------------------
22
related/
33
data/
4+
*.DS_Store
45

56
# ----------------------------------- Julia -----------------------------------------
67
# Files generated by invoking Julia with --code-coverage

bib.bib

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
11
%% This BibTeX bibliography file was created using BibDesk.
22
%% https://bibdesk.sourceforge.io/
33
4-
%% Created for Altmeyer, P. (Patrick) at 2022-01-27 08:17:14 +0100
4+
%% Created for Altmeyer, P. (Patrick) at 2022-02-15 18:39:11 +0100
55
66
77
%% Saved with string encoding Unicode (UTF-8)
88
99
1010
11+
@article{dhurandhar2018explanations,
12+
author = {Dhurandhar, Amit and Chen, Pin-Yu and Luss, Ronny and Tu, Chun-Chen and Ting, Paishun and Shanmugam, Karthikeyan and Das, Payel},
13+
date-added = {2022-02-15 18:26:13 +0100},
14+
date-modified = {2022-02-15 18:26:13 +0100},
15+
journal = {Advances in neural information processing systems},
16+
title = {Explanations based on the missing: Towards contrastive explanations with pertinent negatives},
17+
volume = {31},
18+
year = {2018}}
19+
20+
@article{masini2021machine,
21+
author = {Masini, Ricardo P and Medeiros, Marcelo C and Mendes, Eduardo F},
22+
date-added = {2022-02-07 15:00:00 +0100},
23+
date-modified = {2022-02-07 15:00:00 +0100},
24+
journal = {Journal of Economic Surveys},
25+
publisher = {Wiley Online Library},
26+
title = {Machine learning advances for time series forecasting},
27+
year = {2021}}
28+
1129
@inproceedings{mothilal2020explaining,
1230
author = {Mothilal, Ramaravind K and Sharma, Amit and Tan, Chenhao},
1331
booktitle = {Proceedings of the 2020 Conference on Fairness, Accountability, and Transparency},

src/.DS_Store

6 KB
Binary file not shown.

src/models/deep_ensemble.jl

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,30 +45,28 @@ function forward_nn(nn, loss, data, opt; n_epochs=200, plotting=nothing, τ=1.0)
4545
epoch = 1
4646

4747
while epoch <= n_epochs && !stopping_criterium_reached
48-
4948
for d in data
50-
gs = gradient(Flux.params(nn)) do
51-
l = loss(d...)
49+
gs = gradient(Flux.params(nn)) do
50+
loss(d...)
51+
end
52+
update!(opt, Flux.params(nn), gs)
5253
end
53-
update!(opt, Flux.params(nn), gs)
54-
end
55-
if !isnothing(plotting)
56-
plt = plotting[1]
57-
anim = plotting[2]
58-
idx = plotting[3]
59-
avg_loss(data) = mean(map(d -> loss(d[1],d[2]), data))
60-
avg_l = vcat(avg_l,avg_loss(data))
61-
x_range = maximum([epoch-plotting[4],1]):epoch
62-
if epoch % plotting[4]==0
63-
plot!(plt, x_range, avg_l[x_range], color=idx, alpha=0.3)
64-
frame(anim, plt)
54+
if !isnothing(plotting)
55+
plt = plotting[1]
56+
anim = plotting[2]
57+
idx = plotting[3]
58+
avg_loss(data) = mean(map(d -> loss(d[1],d[2]), data))
59+
avg_l = vcat(avg_l,avg_loss(data))
60+
x_range = maximum([epoch-plotting[4],1]):epoch
61+
if epoch % plotting[4]==0
62+
plot!(plt, x_range, avg_l[x_range], color=idx, alpha=0.3)
63+
frame(anim, plt)
64+
end
6565
end
66-
end
67-
68-
# Check if desired accuracy reached:
69-
stopping_criterium_reached = accuracy() >= τ
70-
epoch += 1
7166

67+
# Check if desired accuracy reached:
68+
stopping_criterium_reached = accuracy() >= τ
69+
epoch += 1
7270
end
7371

7472
return nn

students/project_counterfactual_generators.md

Lines changed: 0 additions & 185 deletions
This file was deleted.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
Responsible Professor: Dr. Cynthia Liem Supervisor: Patrick Altmeyer
2+
3+
## Research questions
4+
5+
Collectively, students will discuss and agree on an answer to the following question:
6+
7+
- How can we quantify endogenous domain and model shifts?
8+
9+
Individually, each of the students will then choose one of the recourse generators already implemented in [CARLA](https://github.com/carla-recourse/CARLA) and run a simple experiment (details below) to generate endogenous shifts and quantify their magnitude. You will also each produce results for the baseline generator ([Wachter](https://arxiv.org/ftp/arxiv/papers/1711/1711.00399.pdf)) and benchmark the results from both generators.
10+
11+
Use the results to answer the following questions with respect to your chosen generator:
12+
13+
- Does the magnitude of induced model shifts differ compared to the baseline generator?
14+
- If so, what factors might be playing a role here?
15+
- Based on your findings, what appear to be good ways to mitigate endogenous shifts?
16+
17+
While the individual part should really be done individually, do keep in mind that you will end up comparing the results of your experiments and you should therefore all generate the same, comparable output.
18+
19+
## Research Methods
20+
21+
Overall, this will be a project focused on benchmarking and experimental design: you will learn about how to use existing tools for benchmarking to asses outcomes from your own experiments.
22+
23+
For a gentle introduction to the topic of algorithmic recourse you can check out this [primer](https://towardsdatascience.com/individual-recourse-for-black-box-models-5e9ed1e4b4cc) written by Patrick as part of his PhD application. To familiarize yourself further with the topic and [CARLA](https://github.com/carla-recourse/CARLA) you should all read this [paper](https://arxiv.org/pdf/2108.00783.pdf).
24+
25+
You are free to choose any of the generators already implemented [CARLA](https://github.com/carla-recourse/CARLA), but below are five suggestions:
26+
27+
1. [FACE](https://arxiv.org/pdf/1909.09369.pdf), \[1\]
28+
2. [REVISE](https://arxiv.org/pdf/1907.09615.pdf), \[2\]
29+
3. [CEM](https://arxiv.org/pdf/1802.07623.pdf), \[3\]
30+
4. [CEM-VAE](https://arxiv.org/pdf/1802.07623.pdf), \[3\]
31+
5. [AR-LIME](https://arxiv.org/pdf/1809.06514.pdf), \[4\]
32+
33+
Since the generators are all conveniently implemented in the same library, running the experiment should require roughly the same effort for all of them. While you are not expected to fully understand in detail the methodology underlying your chosen generator, you should study the relevant paper and ask yourself: what makes your generator particular? What assumptions do the authors make? How do you expect these particularities to affect recourse outcome with respect to endogenous shifts?
34+
35+
**Experiment**
36+
37+
The idea is that you replicate a variation of the following experiement already implemented by Patrick:
38+
39+
1. Train an algorithm ![\\mathcal{M}](https://latex.codecogs.com/svg.latex?%5Cmathcal%7BM%7D "\mathcal{M}") for a binary classification task.
40+
2. Determine a target class. Using your chosen generator and the baseline generator ([Wachter](https://arxiv.org/ftp/arxiv/papers/1711/1711.00399.pdf)) generate recourse for a share ![\\mu](https://latex.codecogs.com/svg.latex?%5Cmu "\mu") of randomly selected individuals in the other class to revise their label (i.e. move to the target class). Store some of the conventional benchmark measures readily implemented in CARLA (cost, success rate, …)
41+
3. Implement recourse for those indviduals and quantify the domain shift.
42+
4. Retrain ![\\mathcal{M}](https://latex.codecogs.com/svg.latex?%5Cmathcal%7BM%7D "\mathcal{M}") and quantify the model shift.
43+
5. Repeat steps 1-4 for ![K](https://latex.codecogs.com/svg.latex?K "K") rounds.
44+
45+
You are free to either follow Patrick’s recipe exactly or tweak the various parameters that determine the experiemntal design as you see fit. Make sure that you end up running the exact same experiment though, in order for the results to be comparable.
46+
47+
**Hypothesis**
48+
49+
I expect to find that generators that focus on creating realistic counterfactuals in high-density regions of the feature domain (REVISE, CEM-VAE) tend to be associated with endogenous shifts of a smaller magnitude compared to generators that do not specifically address this (CEM, Wachter, AR-LIME).
50+
51+
## Relation between sub-projects
52+
53+
The students will collectively design and establish an evaluation benchmark, while each focusing on a particular framework implementation to ultimately evaluate in the benchmark. Researching the intricacies of each framework will lead to clearly individual contributions, while part of the relevant literature is shared, and the final comparison connects the individual insights.
54+
55+
## Responsible Engineering / Computer Science / Research
56+
57+
As noted above, algorithmic recourse was designed in the context of responsible machine learning. Work on this topic should foster an awareness that automated decision-making can have detrimental consequences for individuals and that many researchers are working on approaches to deal with some of those consequences. Comparing different approaches to the issue will also make it clear that in the context of research there is rarely (if ever) one right solution. More to the point of this particular research project, solutions to one particular issue usually open up new questions.
58+
59+
## Possible publication
60+
61+
In 2021 there was an [ICML workshop](https://icml.cc/Conferences/2021/ScheduleMultitrack?event=8363) on algorithmic recourse. Should this workshop take place again, the results of this project could lead to a poster presentation. Later in the year NeurIPS is coming up, which in 2021 also attracted conference and workshop papers on algorithmic recourse and benchmarking.
62+
63+
## References
64+
65+
<div id="refs" class="references csl-bib-body">
66+
67+
<div id="ref-poyiadzi2020face" class="csl-entry">
68+
69+
<span class="csl-left-margin">\[1\] </span><span class="csl-right-inline">Poyiadzi R, Sokol K, Santos-Rodriguez R, De Bie T, Flach P. FACE: Feasible and actionable counterfactual explanations. Proceedings of the AAAI/ACM conference on AI, ethics, and society, 2020, p. 344–50.</span>
70+
71+
</div>
72+
73+
<div id="ref-joshi2019towards" class="csl-entry">
74+
75+
<span class="csl-left-margin">\[2\] </span><span class="csl-right-inline">Joshi S, Koyejo O, Vijitbenjaronk W, Kim B, Ghosh J. Towards realistic individual recourse and actionable explanations in black-box decision making systems. arXiv Preprint arXiv:190709615 2019.</span>
76+
77+
</div>
78+
79+
<div id="ref-dhurandhar2018explanations" class="csl-entry">
80+
81+
<span class="csl-left-margin">\[3\] </span><span class="csl-right-inline">Dhurandhar A, Chen P-Y, Luss R, Tu C-C, Ting P, Shanmugam K, et al. Explanations based on the missing: Towards contrastive explanations with pertinent negatives. Advances in Neural Information Processing Systems 2018;31.</span>
82+
83+
</div>
84+
85+
<div id="ref-ustun2019actionable" class="csl-entry">
86+
87+
<span class="csl-left-margin">\[4\] </span><span class="csl-right-inline">Ustun B, Spangher A, Liu Y. Actionable recourse in linear classification. Proceedings of the conference on fairness, accountability, and transparency, 2019, p. 10–9.</span>
88+
89+
</div>
90+
91+
</div>

0 commit comments

Comments
 (0)