# Explainable AI (XAI) Basics
<br>
<br>
<small>Neil John D. Ortega</small><br>
<small>
<small>ML Engineer @ LINE Fukuoka</small><br>
<small>2021/09/10</small>
</small>
---
## Agenda
- What is XAI?
- Why XAI?
- Taxonomy of methods
- Example: Integrated Gradients (IG)
- Recap
---
## Agenda
- **What is XAI?**
- Why XAI?
- Taxonomy of methods
- Example: Integrated Gradients (IG)
- Recap
----
## What is Explainable AI (XAI)?
- A set of techniques that can be used to make ML models more __understandable__ to humans:<!-- .element: class="fragment" -->
- Allows to ML/DL experts to navigate the _learning phase_ of a model<!-- .element: class="fragment" -->
- Allows _knowledge discovery_ in certain problem domains<!-- .element: class="fragment" -->
- Increases _reliability and robustness_ of ML models against adversarial attacks<!-- .element: class="fragment" -->
----
## XAI Models
- Should be __F.A.S.T.__:<!-- .element: class="fragment" -->
- __F__ air<!-- .element: class="fragment" -->
- __A__ ccountable<!-- .element: class="fragment" -->
- __S__ ecure<!-- .element: class="fragment" -->
- __T__ ransparent<!-- .element: class="fragment" -->
----
## Two Myths..
<span>__Myth #1__: _"Only DL models need explainability."_</span><!-- .element: class="fragment" -->
<span>__Myth #2__: _"Unavoidable trade-off between performance and interpretability."_</span><!-- .element: class="fragment" -->
<div>
__Goal__:

<small><strong>Fig. 1.</strong> Learning performance vs explainability. [2]</small>
</div><!-- .element: class="fragment" -->
----
## Interpretability vs Explainability
<div>
_"All explainable models are interpretable._
_But not all interpretable models are explainable."_
\- Albert Einstein
</div><!-- .element: class="fragment" -->
##### Physics analogy:<!-- .element: class="fragment" -->
- Quantum mechanics - can be used to make predictions about the real (microscopic) world...<!-- .element: class="fragment" -->
- Interpretability is understanding the mechanics of ML/DL<!-- .element: class="fragment" -->
- As to __why__ the quantum world behaves that way, we don't yet have complete understanding<!-- .element: class="fragment" -->
- Explainability is having a global theory<!-- .element: class="fragment" -->
---
## Agenda
- What is XAI?
- **Why XAI?**
- Taxonomy of methods
- Example: Integrated Gradients (IG)
- Recap
----
## Why XAI?
- __Model validation__<!-- .element: class="fragment" -->
- Is the model fair? Is it unbiased? Does it respect privacy?<!-- .element: class="fragment" -->
- Important with compliance to industry rules and regulations, increased adoption in other industries<!-- .element: class="fragment" -->
----
## Why XAI?
- __Model debugging__<!-- .element: class="fragment" -->
- Is the model reliable and robust?<!-- .element: class="fragment" -->
- Is the model transparent and interpretable enough?<!-- .element: class="fragment" -->
- Important when model is misbehaving<!-- .element: class="fragment" -->
----
## Why XAI?
- __Knowledge discovery__<!-- .element: class="fragment" -->
- Can we go beyond prediction? Can the model shed light in areas where explanations and causal relations are lacking?<!-- .element: class="fragment" -->
- Important with scientific applications/discovery<!-- .element: class="fragment" -->
----
## Do we always need XAI?
#### It depends.<!-- .element: class="fragment" -->
## :shrug:<!-- .element: class="fragment" -->
---
## Agenda
- What is XAI?
- Why XAI?
- **Taxonomy of methods**
- Example: Integrated Gradients (IG)
- Recap
----
## Criteria [4]
- __C__ omplete <!-- .element: class="fragment" -->
- __A__ ccurate <!-- .element: class="fragment" -->
- __M__ eaningful <!-- .element: class="fragment" -->
- __C__ onsistent <!-- .element: class="fragment" -->
----
## Intrinsic vs Post-hoc
- __Intrinsic__ depends highly on the kind (i.e. complexity) of the model used<!-- .element: class="fragment" -->
- __Post-hoc__ refers to methods done _after_ the model is trained<!-- .element: class="fragment" -->
<div>

<small><strong>Fig. 2.</strong> Intrinsic vs post-hoc methods. [4]</small>
</div><!-- .element: class="fragment" -->
----
## Local vs Global
- __Local__ focuses on subsets of model prediction space (can be individual sample)<!-- .element: class="fragment" -->
- __Global__ uses aggregated, ranked contributions over entire model prediction space<!-- .element: class="fragment" -->
- Precision vs recall<!-- .element: class="fragment" -->
<div>

<small><strong>Fig. 3.</strong> Local vs global methods. [4]</small>
</div><!-- .element: class="fragment" -->
----
## Model-Specific vs Model-Agnostic
- __Model-specific__ can only be used with specific models (e.g. gradient-based, etc.)<!-- .element: class="fragment" -->
- __Model-agnostic__ can be used with any model (e.g. SHAP, etc.)<!-- .element: class="fragment" -->
<div>

<small><strong>Fig. 4.</strong> Model-specific vs Model-agnostic methods. [4]</small>
</div><!-- .element: class="fragment" -->
----
## Explanation Type [4]
- Feature attribution
- Visualization
- Decision rules
- Counterfactual datapoints
- Approximate models, etc.
---
## Agenda
- What is XAI?
- Why XAI?
- Taxonomy of methods
- **Example: Integrated Gradients (IG)**
- Recap
----
## Integrated Gradients
- Post-hoc<!-- .element: class="fragment" -->
- Model-specific<!-- .element: class="fragment" -->
- Local/global<!-- .element: class="fragment" -->
----
## [Integrated Gradients TF Collab](https://colab.research.google.com/github/tensorflow/docs/blob/master/site/en/tutorials/interpretability/integrated_gradients.ipynb) :computer:
---
## Agenda
- What is XAI?
- Why XAI?
- Taxonomy of methods
- Example: Integrated Gradients (IG)
- **Recap**
----
<style>
.reveal h1 {font-size: 2.0em !important;}
.reveal h2 {font-size: 1.28em !important;}
.reveal ul {font-size: 32px !important;}
.reveal ol strong,
.reveal ul strong {
color: #E26A6A !important;
}
</style>
## Recap
- XAI is a set of techniques aimed at making ML/DL models more transparent<!-- .element: class="fragment" -->
- XAI can be applied for model validation, model debugging, and knowledge discovery<!-- .element: class="fragment" -->
- XAI methods can be classified (loosely) into different categories to facilitate further study<!-- .element: class="fragment" -->
- Integrated Gradient is one method that can be used to interpret gradient-based methods<!-- .element: class="fragment" -->
---
# Thank you! :nerd_face:
---
## References
<!-- .slide: data-id="references" -->
<style>
.reveal p {font-size: 20px !important;}
.reveal ul, .reveal ol {
display: block !important;
font-size: 18px !important;
}
.reveal li {line-height: 1.4 !important;}
section[data-id="references"] p {
text-align: center !important;
}
</style>
- [1] Du, Mengnan, et al. “[Techniques for Interpretable Machine Learning](https://arxiv.org/abs/1808.00033).” Communications of the ACM, vol. 63, no. 1, 2019, pp. 68–77., doi:10.1145/3359786.
- [2] Gianfagna, Leonida, and Antonio Di Cecco. Explainable AI with Python. Springer, 2021.
- [3] “Integrated Gradients: Tensorflow Core.” TensorFlow, www.tensorflow.org/tutorials/interpretability/integrated_gradients.
- [4] “Introduction to Explainable AI (ML Tech Talks).” YouTube, YouTube, 15 July 2021, www.youtube.com/watch?v=6xePkn3-LME.
- [5] Sun, Yi, and Mukund Sundararajan. “[Axiomatic Attribution for Multilinear Functions](https://arxiv.org/abs/1703.01365).” Proceedings of the 12th ACM Conference on Electronic Commerce - EC '11, 2011, doi:10.1145/1993574.1993601.
{"metaMigratedAt":"2023-06-16T09:57:03.498Z","metaMigratedFrom":"YAML","title":"Explainable AI (XAI)","breaks":true,"description":"View the slide with \"Slide Mode\".","slideOptions":"{\"spotlight\":{\"enabled\":false}}","contributors":"[{\"id\":\"ed2adf4d-7b64-4cc8-9c2f-656c184d7122\",\"add\":7649,\"del\":8916}]"}