Discover more from Mindful Modeler
Interpreting Machine Learning Models With SHAP is published 🥳
A Guide With Python Examples And Theory On Shapley Values
My book “Interpreting machine learning models with SHAP” is published. 🎉 🎉 🎉
This book has, in some ways been simpler to write than my other books. I already had lots of material and already worked a lot on machine learning interpretability. But it has also been much more exhaustive because it had 3 rounds of reviews with beta readers with a total of 28 people leaving feedback. This immensely shaped and reshaped the book and I’m very happy with how it turned out. Thank you to everyone involved. ❤️
Why I picked up SHAP as a topic
I disliked SHAP when I did research on interpretable machine learning. My research focused on methods like permutation feature importance and partial dependence plots. Too uncool for some people it seemed, because more than once were our papers rejected because we didn’t focus on the new and shiny LIME and SHAP in the interpretability space. Thanks, reviewer #2!
SHAP was popular early on and later emerged as one of the most popular interpretation methods, even beating the, back then, most famous kid on the blog called LIME. For good reason, since I wouldn’t recommend LIME. Over time I managed to look behind the curtain of hype and my own dislike of SHAP and found not only an interpretation method but an entire ecosystem and community behind it:
SHAP can be used to explain individual predictions (=local interpretation) as well as provide an interpretation of the average model behavior (=global interpretation)
SHAP is model-agnostic, which means it works for any model. It doesn’t matter whether the underlying model is an xgboost model or a neural network.
SHAP can handle various data formats, whether it’s tabular, image, or text.
The Python package
shapmakes the application of SHAP for model interpretation easy. But there are also many other libraries that implement SHAP.
shappackage has 10+ estimators implemented, and offers various types of plots and tools.
Dealing with an ecosystem instead of “just” another ML interpretation method can be rewarding, but also quite daunting.
There’s tons of material on SHAP - why write a book?
Dozens or maybe hundreds of blog posts cover SHAP values, the
shap library contains extensive documentation, and there are multiple interpretable ML books that have a chapter on SHAP, isn’t that enough information?
In a way, this makes it even more difficult to get an overview of SHAP’s ecosystem. Quite a lot of the posts are already outdated since they might use the old syntax of the
shap package or they still focus on the Kernel estimation method which turned out to be too slow.
My book “Interpreting Machine Learning Models With SHAP” provides a comprehensive guide to SHAP, from theory and intuition to code examples, tips, and limitations. SHAP is such a big ecosystem and I think a book is the one-stop-shop to cover the needs.
There’s no other resource with the same kind of overview of the many ways to estimate SHAP values, the many visualization tools, the complex theory, and the actual interpretation of SHAP values.
This book will be your comprehensive guide to mastering the theory and application of SHAP. It starts with the quite fascinating origins in game theory and explores what splitting taxi costs has to do with explaining machine learning predictions. Starting with SHAP to explain a simple linear regression model, the book progressively introduces SHAP for more complex models. You’ll learn the ins and outs of the most popular explainable AI method and how to apply it using the
You can get the ebook here: Interpreting Machine Learning Models With SHAP
For the print version, you need a bit more patience. I expect to publish the paperback in September.
What Others Said About The Book
This book takes readers on a comprehensive journey from foundational concepts to practical applications of SHAP. It conveys clear explanations, step-by-step instructions, and real-world case studies designed for beginners and experienced practitioners to gain the knowledge and tools needed to leverage Shapley Values for model interpretability/explainability effectively.
— Carlos Mougan, Marie Skłodowska-Curie AI Ethics Researcher
This book is a comprehensive guide in dealing with SHAP values and acts as an excellent companion to the interpretable machine learning book. Christoph Molnar's expertise as a statistician shines through as he distills the theory of SHAP values and their crucial role in understanding Machine Learning predictions into an accessible and easy to read text.
— Junaid Butt, Research Software Engineer at IBM Research
As in all his work, Christoph once again demonstrates his ability to make complex concepts accessible through clear visuals and concise explanations. Showcasing practical examples across a range of applications brings the principles of SHAP to life. This comes together as a thought provoking, informative read for anyone tasked with translating model insights to diverse audiences.
Joshua Le Cornu, Orbis Investments
In other news
I had a great conversation on the AI Fundamentalists podcast! We talked about machine learning interpretability, conformal prediction, and more!