The Alan Turing Institute
Delft University of Technology
2024-05-08
Economist by training, previously Bank of England, currently 3rd year PhD in Trustworthy AI @ TU Delft.
Why Trustworthy AI and why in Julia?
Taija is the organization that hosts software geared towards Trustworthy Artificial Intelligence in Julia.
The TaijaBase.jl package provides common symbols, types and functions that are used across all or multiple Taija packages.
CounterfactualExplanations.jl
and LaplaceRedux.jl
at JuliaCon.ConformalPrediction.jl
at JuliaCon.CounterfactualExplanations.jl
and LaPlaceRedux.jl
.CounterfactualExplanations.jl
published in JuliaCon proceedings.CounterfactualExplanations.jl
and LaplaceRedux.jl
at JuliaCon.TaijaInteractive.jl
.ConformalPrediction.jl
at JuliaCon.CounterfactualExplanations.jl
and LaPlaceRedux.jl
.CounterfactualExplanations.jl
published in JuliaCon proceedings.CounterfactualExplanations.jl
and LaplaceRedux.jl
at JuliaCon.Taija has been used in the following publications:
CounterfactualExplanations.jl
: A package for Counterfactual Explanations and Algorithmic Recourse in Julia.
\[ \begin{aligned} \min_{\mathbf{Z}^\prime \in \mathcal{Z}^L} \{ {\text{yloss}(M_{\theta}(f(\mathbf{Z}^\prime)),\mathbf{y}^+)} + \lambda {\text{cost}(f(\mathbf{Z}^\prime)) } \} \end{aligned} \]
Counterfactual Explanations (CE) explain how inputs into a model need to change for it to produce different outputs.
📜 Altmeyer, Deursen, et al. (2023) @ JuliaCon 2022.
All of these counterfactuals are valid explanations for the model’s prediction.
Which one would you pick?
Figure 2: Turning a 9 into a 7: Counterfactual explanations for an image classifier produced using Wachter (Wachter, Mittelstadt, and Russell 2017), Schut (Schut et al. 2021) and REVISE (Joshi et al. 2019).
📜 Altmeyer, Farmanbar, et al. (2023) @ AAAI 2024
Key Idea
Use the hybrid objective of joint energy models (JEM) and a model-agnostic penalty for predictive uncertainty: Energy-Constrained (\(\mathcal{E}_{\theta}\)) Conformal (\(\Omega\)) Counterfactuals (ECCCo).
ECCCo objective1:
\[ \begin{aligned} & \min_{\mathbf{Z}^\prime \in \mathcal{Z}^L} \{ {L_{\text{clf}}(f(\mathbf{Z}^\prime);M_{\theta},\mathbf{y}^+)}+ \lambda_1 {\text{cost}(f(\mathbf{Z}^\prime)) } \\ &+ \lambda_2 \mathcal{E}_{\theta}(f(\mathbf{Z}^\prime)|\mathbf{y}^+) + \lambda_3 \Omega(C_{\theta}(f(\mathbf{Z}^\prime);\alpha)) \} \end{aligned} \]
CounterfactualExplanations.jl
(LLM explainability, imbalanced data, recourse in practice and counterfactuals for model testing).ConformalPrediction.jl
: A package for Predictive Uncertainty Quantification through Conformal Prediction for Machine Learning models trained in MLJ.
Intuitively, CP works under the premise of turning heuristic notions of uncertainty into rigorous uncertainty estimates through repeated sampling or the use of dedicated calibration data.
Conformal Prediction in action: prediction intervals at varying coverage rates. As coverage grows, so does the width of the prediction interval.
ConformalPrediction.jl
meets SymbolicRegression.jl
.
TaijaParallel.jl
.… if time permits at the end.
First time here? Take a quick interactive tour to see what this package can do right on JuliaHub (To run the notebook, hit login and then edit).
This Pluto.jl
🎈 notebook won the 2nd Price in the JuliaCon 2023 Notebook Competition.
LaplaceRedux.jl
: A package for Effortless Bayesian Deep Learning through Laplace Approximation for Flux.jl neural networks.
We want BMA for neural networks underspecified by the data (Wilson 2020),
\[ p(y|x,\mathcal{D}) = \int p(y|x,\theta)p(\theta|\mathcal{D})d\theta \tag{1}\]
where \(p(y|x,\theta)\) is the likelihood, \(p(\theta|\mathcal{D})\) is the posterior and \(\mathcal{D}\) is the training data.
Example (binary classification): We assume Bernoulli likelihood and a Gaussian prior for our weights …
\[ p(y_n|\mathbf{x}_n;\mathbf{w})\sim\text{Ber}(y_n|\sigma(\mathbf{w}^T\mathbf{x}_n)) \tag{2}\]
\[ p(\theta) \sim \mathcal{N} \left( \theta | \mathbf{0}, \lambda^{-1} \mathbf{I} \right)=\mathcal{N} \left( \theta | \mathbf{0}, \mathbf{H}_0^{-1} \right) \tag{3}\]
… which yields the following negative log-likelihood (or energy) function (Murphy 2022):
\[ \psi(\theta)= - \sum_{n}^N [y_n \log \mu_n + (1-y_n)\log (1-\mu_n)] + \\ \frac{1}{2} (\theta-\theta_0)^T\mathbf{H}_0(\theta-\theta_0) \tag{4}\]
We have the following normalized posterior:
\[ p(\theta|\mathcal{D}) = Z^{-1} p(\mathcal{D}|\theta)p(\theta) = Z^{-1} \exp(-\psi(\theta)) \tag{5}\]
with \(Z = \int p(\mathcal{D}|\theta) p(\theta)\).
Then, second-order Taylor expansion of the energy function around the mode \(\theta_0\) gives us the Laplace approximation (Murphy 2022):
\[ \psi(\theta) \approxeq \psi(\hat\theta) + \frac{1}{2} (\theta-\hat\theta)^T \mathbf{H}(\theta-\hat\theta) \tag{6}\]
Thus, we have
\[ p(\theta|\mathcal{D}) \approxeq \mathcal{N}(\theta;\hat\theta,-\mathbf{H}^{-1}) \tag{7}\]
JointEnergyModels.jl
: A package for Joint Energy Models and Energy-Based Models in Julia.
Joint Energy Models (JEM) are a class of energy-based models that learn a joint distribution over inputs and outputs (Grathwohl et al. 2020).
Training JEMs.
v0.6
) in 2017 during my master’s but quickly abandoned it.Transformers.jl
).