Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Interpretable Machine Learning with Python

You're reading from   Interpretable Machine Learning with Python Build explainable, fair, and robust high-performance models with hands-on, real-world examples

Arrow left icon
Product type Paperback
Published in Oct 2023
Publisher Packt
ISBN-13 9781803235424
Length 606 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Serg Masís Serg Masís
Author Profile Icon Serg Masís
Serg Masís
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Interpretation, Interpretability, and Explainability; and Why Does It All Matter? 2. Key Concepts of Interpretability FREE CHAPTER 3. Interpretation Challenges 4. Global Model-Agnostic Interpretation Methods 5. Local Model-Agnostic Interpretation Methods 6. Anchors and Counterfactual Explanations 7. Visualizing Convolutional Neural Networks 8. Interpreting NLP Transformers 9. Interpretation Methods for Multivariate Forecasting and Sensitivity Analysis 10. Feature Selection and Engineering for Interpretability 11. Bias Mitigation and Causal Inference Methods 12. Monotonic Constraints and Model Tuning for Interpretability 13. Adversarial Robustness 14. What’s Next for Machine Learning Interpretability? 15. Other Books You May Enjoy
16. Index

What this book covers

Chapter 1, Interpretation, Interpretability, and Explainability; and Why Does It All Matter?, introduces machine learning interpretation and related concepts, such as interpretability, explainability, black-box models, and transparency, providing definitions for these terms to avoid ambiguity. We then underpin the value of machine learning interpretability for businesses.

Chapter 2, Key Concepts of Interpretability, uses a cardiovascular disease prediction example to introduce two fundamental concepts (feature importance and decision regions) and the most important taxonomies used to classify interpretation methods. We also detail what elements hinder machine learning interpretability as a primer for what lies ahead.

Chapter 3, Interpretation Challenges, discusses the traditional methods used for machine learning interpretation for regression and classification with a flight delay prediction problem. We will then examine the limitations of these traditional methods and explain what makes “white-box” models intrinsically interpretable and why we cannot always use white-box models. To answer this question, we consider the trade-off between prediction performance and model interpretability. Finally, we will discover some new “glass-box” models that attempt to not compromise in this trade-off.

Chapter 4, Global Model-Agnostic Interpretation Methods, explores Partial Dependence Plots (PDP) and game-theory-inspired SHapley Additive exPlanations (SHAP) with used car pricing regression models, then visualizes conditional marginal distribution Accumulated Local Effects (ALE) plots.

Chapter 5, Local Model-Agnostic Interpretation Methods, covers local interpretation methods, explaining a single or a group of predictions. To this end, the chapter covers how to leverage SHAP and Local Interpretable Model-agnostic Explanations (LIME) for local interpretations with a chocolate bar rating example, with both tabular and text data.

Chapter 6, Anchors and Counterfactual Explanations, continues with local model interpretations, but only for classification problems. We use a recidivism risk prediction example to understand how we can explain unfair predictions in a human-interpretable way. This chapter covers anchors, counterfactuals, and the What-If-Tool (WIT).

Chapter 7, Visualizing Convolutional Neural Networks, explores interpretation methods that work with Convolutional Neural Network (CNN) models with a garbage classifier model. Once we have grasped how a CNN learns with activations, we will study several gradient-based attribution methods, such as saliency maps, Grad-CAM, and integrated gradients, to debug class attribution. Lastly, we will extend our attribution debugging know-how with perturbation-based attribution methods such as feature ablation, occlusion sensitivity, Shapley value sampling, and KernelSHAP.

Chapter 8, Interpreting NLP Transformers, discusses how to visualize attention mechanisms in a restaurant review sentiment classifier transformer model, followed by interpreting integrated gradient attributions and exploring the Learning Interpretability Tool (LIT).

Chapter 9, Interpretation Methods for Multivariate Forecasting and Sensitivity Analysis, uses a traffic forecasting problem and Long Short-Term Memory (LSTM) models to show how to employ integrated gradients and SHAP for this use case. Lastly, the chapter looks at how forecasting and uncertainty are intrinsically linked, and sensitivity analysis – a family of methods designed to measure the uncertainty of a model’s output in relation to its input. We study two methods: Morris for factor prioritization and Sobol for factor fixing.

Chapter 10, Feature Selection and Engineering for Interpretability, uses a challenging non-profit direct mailing optimization problem to review filter-based feature selection methods, such as Spearman’s correlation and learn about embedded methods, such as Lasso. Then, you will discover wrapper methods, such as sequential feature selection and hybrid ones, such as recursive feature elimination, as well as more advanced ones, such as genetic algorithms. Lastly, even though feature engineering is typically conducted before selection, there’s value in exploring feature engineering for many reasons after the dust has settled.

Chapter 11, Bias Mitigation and Causal Inference Methods, takes a credit card default problem to demonstrate leveraging fairness metrics and visualizations to detect undesired bias. Then, the chapter looks at how to reduce it via preprocessing methods such as reweighting and prejudice remover for in-processing and equalized odds for post-processing. Then, we test treatments for lowering credit card default and leverage causal modeling to determine their Average Treatment Effects (ATE) and Conditional Average Treatment Effects (CATE). Finally, we test causal assumptions and the robustness of estimates.

Chapter 12, Monotonic Constraints and Model Tuning for Interpretability, continues with the recidivism risk prediction problem from Chapter 7. We will learn how to place guardrails with feature engineering on the data side and monotonic and interaction constraints on the model to ensure fairness while also learning how to tune a model when there are several objectives.

Chapter 13, Adversarial Robustness, uses a face mask detection problem to cover an end-to-end adversarial solution. An adversary can purposely thwart a model in many ways, and we focus on evasion attacks, such as Carlini and Wagner infinity-norm and adversarial patches, and briefly explain other forms of attack. We explain two defense methods: spatial smoothing preprocessing and adversarial training. Lastly, we demonstrate a robustness evaluation method.

Chapter 14, What’s Next for Machine Learning Interpretability?, summarizes what was learned in the context of the ecosystem of machine learning interpretability methods. And then speculates on what’s to come next!

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image