Skip to content
Snippets Groups Projects
Commit a12f3f05 authored by pat-alt's avatar pat-alt
Browse files
parents 4ff5f10a 5ab6c75e
No related branches found
No related tags found
No related merge requests found
...@@ -421,8 +421,6 @@ function _plot_eccco_mnist( ...@@ -421,8 +421,6 @@ function _plot_eccco_mnist(
plts = [plts..., plt] plts = [plts..., plt]
_count += 1 _count += 1
end end
# plts = plts[_plt_order]
# plts = [p1, plts...]
plt = Plots.plot(plts...; size=(img_height,img_height)) plt = Plots.plot(plts...; size=(img_height,img_height))
return plt, eccco_generator, ces return plt, eccco_generator, ces
...@@ -489,7 +487,7 @@ end ...@@ -489,7 +487,7 @@ end
``` ```
```{julia} ```{julia}
_regen_all_digits = true _regen_all_digits = false
if _regen_all_digits if _regen_all_digits
function plot_all_digits(rng=123;verbose=true,img_height=180,kwargs...) function plot_all_digits(rng=123;verbose=true,img_height=180,kwargs...)
plts = [] plts = []
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
%% This BibTeX bibliography file was created using BibDesk. %% This BibTeX bibliography file was created using BibDesk.
%% https://bibdesk.sourceforge.io/ %% https://bibdesk.sourceforge.io/
%% Created for Patrick Altmeyer at 2022-12-13 12:58:22 +0100 %% Created for Anonymous Author at 2022-12-13 12:58:22 +0100
%% Saved with string encoding Unicode (UTF-8) %% Saved with string encoding Unicode (UTF-8)
......
...@@ -13,7 +13,7 @@ Model & Generator & Unfaithfulness ↓ & Implausibility ↓ & Unfaithfulness ↓ ...@@ -13,7 +13,7 @@ Model & Generator & Unfaithfulness ↓ & Implausibility ↓ & Unfaithfulness ↓
& REVISE & 188.70 ± 26.18*\hphantom{*} & \textbf{255.26 ± 41.50}** & 186.40 ± 28.06\hphantom{*}\hphantom{*} & \textbf{5.34 ± 2.38}**\\ & REVISE & 188.70 ± 26.18*\hphantom{*} & \textbf{255.26 ± 41.50}** & 186.40 ± 28.06\hphantom{*}\hphantom{*} & \textbf{5.34 ± 2.38}**\\
& Schut & 211.00 ± 27.21\hphantom{*}\hphantom{*} & 286.61 ± 39.85*\hphantom{*} & 200.98 ± 28.49\hphantom{*}\hphantom{*} & 6.50 ± 2.01**\\ & Schut & 211.62 ± 27.13\hphantom{*}\hphantom{*} & 290.56 ± 40.66*\hphantom{*} & 200.98 ± 28.49\hphantom{*}\hphantom{*} & 6.50 ± 2.01**\\
\multirow{-4}{*}{\raggedright\arraybackslash JEM} & Wachter & 222.90 ± 26.56\hphantom{*}\hphantom{*} & 361.88 ± 39.74\hphantom{*}\hphantom{*} & 214.08 ± 45.35\hphantom{*}\hphantom{*} & 61.04 ± 2.58\hphantom{*}\hphantom{*}\\ \multirow{-4}{*}{\raggedright\arraybackslash JEM} & Wachter & 222.90 ± 26.56\hphantom{*}\hphantom{*} & 361.88 ± 39.74\hphantom{*}\hphantom{*} & 214.08 ± 45.35\hphantom{*}\hphantom{*} & 61.04 ± 2.58\hphantom{*}\hphantom{*}\\
\cmidrule{1-6} \cmidrule{1-6}
...@@ -21,7 +21,7 @@ Model & Generator & Unfaithfulness ↓ & Implausibility ↓ & Unfaithfulness ↓ ...@@ -21,7 +21,7 @@ Model & Generator & Unfaithfulness ↓ & Implausibility ↓ & Unfaithfulness ↓
& REVISE & 173.59 ± 20.65** & \textbf{246.32 ± 37.46}** & 194.24 ± 35.41\hphantom{*}\hphantom{*} & \textbf{4.95 ± 1.26}**\\ & REVISE & 173.59 ± 20.65** & \textbf{246.32 ± 37.46}** & 194.24 ± 35.41\hphantom{*}\hphantom{*} & \textbf{4.95 ± 1.26}**\\
& Schut & 205.33 ± 24.07\hphantom{*}\hphantom{*} & 287.39 ± 39.33*\hphantom{*} & 208.45 ± 34.60\hphantom{*}\hphantom{*} & 6.12 ± 1.91**\\ & Schut & 204.36 ± 23.14\hphantom{*}\hphantom{*} & 290.64 ± 39.49*\hphantom{*} & 208.45 ± 34.60\hphantom{*}\hphantom{*} & 6.12 ± 1.91**\\
\multirow{-4}{*}{\raggedright\arraybackslash JEM Ensemble} & Wachter & 217.67 ± 23.78\hphantom{*}\hphantom{*} & 363.23 ± 39.24\hphantom{*}\hphantom{*} & 186.19 ± 33.88\hphantom{*}\hphantom{*} & 60.70 ± 44.32\hphantom{*}\hphantom{*}\\ \multirow{-4}{*}{\raggedright\arraybackslash JEM Ensemble} & Wachter & 217.67 ± 23.78\hphantom{*}\hphantom{*} & 363.23 ± 39.24\hphantom{*}\hphantom{*} & 186.19 ± 33.88\hphantom{*}\hphantom{*} & 60.70 ± 44.32\hphantom{*}\hphantom{*}\\
\cmidrule{1-6} \cmidrule{1-6}
...@@ -29,7 +29,7 @@ Model & Generator & Unfaithfulness ↓ & Implausibility ↓ & Unfaithfulness ↓ ...@@ -29,7 +29,7 @@ Model & Generator & Unfaithfulness ↓ & Implausibility ↓ & Unfaithfulness ↓
& REVISE & 365.82 ± 15.35*\hphantom{*} & \textbf{249.49 ± 41.55}** & 196.75 ± 41.25\hphantom{*}\hphantom{*} & \textbf{4.84 ± 0.60}**\\ & REVISE & 365.82 ± 15.35*\hphantom{*} & \textbf{249.49 ± 41.55}** & 196.75 ± 41.25\hphantom{*}\hphantom{*} & \textbf{4.84 ± 0.60}**\\
& Schut & 382.44 ± 17.81\hphantom{*}\hphantom{*} & 285.98 ± 42.48*\hphantom{*} & 212.00 ± 41.15\hphantom{*}\hphantom{*} & 6.44 ± 1.34**\\ & Schut & 379.66 ± 17.16\hphantom{*}\hphantom{*} & 290.07 ± 42.65*\hphantom{*} & 212.00 ± 41.15\hphantom{*}\hphantom{*} & 6.44 ± 1.34**\\
\multirow{-4}{*}{\raggedright\arraybackslash MLP} & Wachter & 386.05 ± 16.60\hphantom{*}\hphantom{*} & 361.83 ± 42.18\hphantom{*}\hphantom{*} & 218.34 ± 53.26\hphantom{*}\hphantom{*} & 45.84 ± 39.39\hphantom{*}\hphantom{*}\\ \multirow{-4}{*}{\raggedright\arraybackslash MLP} & Wachter & 386.05 ± 16.60\hphantom{*}\hphantom{*} & 361.83 ± 42.18\hphantom{*}\hphantom{*} & 218.34 ± 53.26\hphantom{*}\hphantom{*} & 45.84 ± 39.39\hphantom{*}\hphantom{*}\\
\cmidrule{1-6} \cmidrule{1-6}
...@@ -37,7 +37,7 @@ Model & Generator & Unfaithfulness ↓ & Implausibility ↓ & Unfaithfulness ↓ ...@@ -37,7 +37,7 @@ Model & Generator & Unfaithfulness ↓ & Implausibility ↓ & Unfaithfulness ↓
& REVISE & 337.74 ± 11.89*\hphantom{*} & \textbf{247.67 ± 38.36}** & 207.21 ± 43.20\hphantom{*}\hphantom{*} & \textbf{5.78 ± 2.10}**\\ & REVISE & 337.74 ± 11.89*\hphantom{*} & \textbf{247.67 ± 38.36}** & 207.21 ± 43.20\hphantom{*}\hphantom{*} & \textbf{5.78 ± 2.10}**\\
& Schut & 359.54 ± 14.52\hphantom{*}\hphantom{*} & 283.99 ± 41.08*\hphantom{*} & 205.36 ± 32.11\hphantom{*}\hphantom{*} & 7.00 ± 2.15**\\ & Schut & 354.80 ± 13.05\hphantom{*}\hphantom{*} & 285.79 ± 41.33*\hphantom{*} & 205.36 ± 32.11\hphantom{*}\hphantom{*} & 7.00 ± 2.15**\\
\multirow{-4}{*}{\raggedright\arraybackslash MLP Ensemble} & Wachter & 360.79 ± 14.39\hphantom{*}\hphantom{*} & 357.73 ± 42.55\hphantom{*}\hphantom{*} & 213.71 ± 54.17\hphantom{*}\hphantom{*} & 73.09 ± 64.50\hphantom{*}\hphantom{*}\\ \multirow{-4}{*}{\raggedright\arraybackslash MLP Ensemble} & Wachter & 360.79 ± 14.39\hphantom{*}\hphantom{*} & 357.73 ± 42.55\hphantom{*}\hphantom{*} & 213.71 ± 54.17\hphantom{*}\hphantom{*} & 73.09 ± 64.50\hphantom{*}\hphantom{*}\\
\bottomrule \bottomrule
......
- don't understand why last two paragraphs of the results section are scratched through, they seem important to me
-
\ No newline at end of file
No preview for this file type
...@@ -69,26 +69,17 @@ Energy-Constrained Conformal Counterfactuals} ...@@ -69,26 +69,17 @@ Energy-Constrained Conformal Counterfactuals}
\author{% \author{%
Patrick Altmeyer\thanks{See also: https://www.paltmeyer.com/} \\ Anonymous Author\thanks{See also: } \\
Faculty of Electrical Engineering, Mathematics and Computer Science\\ Faculty \\
Delft University of Technology\\ University \\
2628 XE Delft, The Netherlands \\ Address \\
\texttt{p.altmeyer@tudelft.nl} \\ \texttt{email} \\
\And \And
Mojtaba Farmanbar \\ Anonymous Author\thanks{See also: } \\
ING Netherlands \\ Faculty \\
1102 CT Amsterdam, The Netherlands \\ University \\
\texttt{mojtaba.farmanbar@ing.com} \\ Address \\
\AND \texttt{email} \\
Arie van Deursen \\
Delft University of Technology\\
2628 XE Delft, The Netherlands \\
\texttt{arie.vandeursen@tudelft.nl} \\
\And
Cynthia C. S. Liem \\
Delft University of Technology\\
2628 XE Delft, The Netherlands \\
\texttt{c.c.s.liem@tudelft.nl} \\
} }
......
**Title**: ECCCos from the Black Box: Faithful Explanations through Energy-Constrained Conformal Counterfactuals
**Keywords**: Explainable AI, Counterfactual Explanations, Algorithmic Recourse, Energy-Based Models, Conformal Prediction
**Abstract**: Counterfactual Explanations offer an intuitive and straightforward way to explain black-box models and offer Algorithmic Recourse to individuals. To address the need for plausible explanations, existing work has primarily relied on surrogate models to learn how the input data is distributed. This effectively reallocates the task of learning realistic explanations for the data from the model itself to the surrogate. Consequently, the generated explanations may seem plausible to humans but need not necessarily describe the behaviour of the black-box model faithfully. We formalise this notion of faithfulness through the introduction of a tailored evaluation metric and propose a novel algorithmic framework for generating **E**nergy-**C**onstrained **C**onformal **Co**unterfactuals (ECCCos) that are only as plausible as the model permits. Through extensive empirical studies, we demonstrate that ECCCos reconcile the need for faithfulness and plausibility. In particular, we show that for models with gradient access, it is possible to achieve state-of-the-art performance without the need for surrogate models. To do so, our framework relies solely on properties defining the black-box model itself by leveraging recent advances in Energy-Based Modelling and Conformal Prediction. To our knowledge, this is the first venture in this direction for generating faithful Counterfactual Explanations. Thus, we anticipate that ECCCos can serve as a baseline for future research. We believe that our work opens avenues for researchers and practitioners seeking tools to better distinguish trustworthy from unreliable models.
**Corresponding Author**: p.altmeyer@tudelft.nl
**Revier Nomination**: Arie.vanDeursen@tudelft.nl
**Primary Area**: Interpretability and Explainability
**Claims**: Yes
**Code of Ethics**: Yes
**Broader Impacts**: A narrow focus on generating plausible counterfactuals may lead practitioners and researchers to believe that even a highly vulnerable black-box model has learned plausible data representations. Our work aims to mitigate this.
**Limitations**: Yes
**Theory**: While we do not include any theoretical results in terms of formal proofs, we have approached the topic of Counterfactual Explanations from a new theoretical angle in this work. Where necessary we have clearly stated our assumptions.
**Experiments**: Yes
**Training Details**: Yes
**Error Bars**: Yes
**Compute**: All of our experiments could be run locally on a personal machine. We will provide details regarding training times and compute in the supplementary material.
**Reproducibility**: Yes
**Safeguards**: n/a
**Licenses**: Yes
**Assets**: Yes
**Human Subjects**: n/a
**IRB Approvals**: n/a
**TLDR**: We leverage ideas from Energy-Based Modelling and Conformal Prediction to generate faithful Counterfactual Explanations that can distinguish trustworthy from unreliable models.
#!/bin/bash
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
USERNAME=${1:-vscode}
if [ -z $HOME ]; then
HOME="/root"
fi
FAILED=()
echoStderr()
{
echo "$@" 1>&2
}
check() {
LABEL=$1
shift
echo -e "\n🧪 Testing $LABEL"
if "$@"; then
echo "✅ Passed!"
return 0
else
echoStderr "❌ $LABEL check failed."
FAILED+=("$LABEL")
return 1
fi
}
checkMultiple() {
PASSED=0
LABEL="$1"
echo -e "\n🧪 Testing $LABEL."
shift; MINIMUMPASSED=$1
shift; EXPRESSION="$1"
while [ "$EXPRESSION" != "" ]; do
if $EXPRESSION; then ((PASSED++)); fi
shift; EXPRESSION=$1
done
if [ $PASSED -ge $MINIMUMPASSED ]; then
echo "✅ Passed!"
return 0
else
echoStderr "❌ $LABEL check failed."
FAILED+=("$LABEL")
return 1
fi
}
checkOSPackages() {
LABEL=$1
shift
echo -e "\n🧪 Testing $LABEL"
if dpkg-query --show -f='${Package}: ${Version}\n' "$@"; then
echo "✅ Passed!"
return 0
else
echoStderr "❌ $LABEL check failed."
FAILED+=("$LABEL")
return 1
fi
}
checkExtension() {
# Happens asynchronusly, so keep retrying 10 times with an increasing delay
EXTN_ID="$1"
TIMEOUT_SECONDS="${2:-10}"
RETRY_COUNT=0
echo -e -n "\n🧪 Looking for extension $1 for maximum of ${TIMEOUT_SECONDS}s"
until [ "${RETRY_COUNT}" -eq "${TIMEOUT_SECONDS}" ] || \
[ ! -e $HOME/.vscode-server/extensions/${EXTN_ID}* ] || \
[ ! -e $HOME/.vscode-server-insiders/extensions/${EXTN_ID}* ] || \
[ ! -e $HOME/.vscode-test-server/extensions/${EXTN_ID}* ] || \
[ ! -e $HOME/.vscode-remote/extensions/${EXTN_ID}* ]
do
sleep 1s
(( RETRY_COUNT++ ))
echo -n "."
done
if [ ${RETRY_COUNT} -lt ${TIMEOUT_SECONDS} ]; then
echo -e "\n✅ Passed!"
return 0
else
echoStderr -e "\n❌ Extension $EXTN_ID not found."
FAILED+=("$LABEL")
return 1
fi
}
checkCommon()
{
PACKAGE_LIST="apt-utils \
git \
openssh-client \
less \
iproute2 \
procps \
curl \
wget \
unzip \
nano \
jq \
lsb-release \
ca-certificates \
apt-transport-https \
dialog \
gnupg2 \
libc6 \
libgcc1 \
libgssapi-krb5-2 \
liblttng-ust0 \
libstdc++6 \
zlib1g \
locales \
sudo"
# Actual tests
checkOSPackages "common-os-packages" ${PACKAGE_LIST}
checkMultiple "vscode-server" 1 "[ -d $HOME/.vscode-server/bin ]" "[ -d $HOME/.vscode-server-insiders/bin ]" "[ -d $HOME/.vscode-test-server/bin ]" "[ -d $HOME/.vscode-remote/bin ]" "[ -d $HOME/.vscode-remote/bin ]"
check "non-root-user" id ${USERNAME}
check "locale" [ $(locale -a | grep en_US.utf8) ]
check "sudo" sudo echo "sudo works."
check "zsh" zsh --version
check "oh-my-zsh" [ -d "$HOME/.oh-my-zsh" ]
#check "login-shell-path" [ -f "/etc/profile.d/00-restore-env.sh" ]
check "code" which code
}
reportResults() {
if [ ${#FAILED[@]} -ne 0 ]; then
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
exit 1
else
echo -e "\n💯 All passed!"
exit 0
fi
}
fixTestProjectFolderPrivs() {
if [ "${USERNAME}" != "root" ]; then
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
sudo chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
fi
fi
}
\ No newline at end of file
#!/bin/bash
cd $(dirname "$0")
source test-utils-no-lc.sh vscode
# Run common tests
checkCommon
# Definition specific tests
checkExtension "julialang.language-julia"
check "julia" julia --version
# Report result
reportResults
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment