Explainable AI
for Practitioners
Designing and Implementing
Explainable ML Solutions
Michael Munn &
David Pitman
Foreword by Ankur Taly
,Explainable AI for Practitioners
Most intermediate-level machine learning books focus on
how to optimize models by increasing accuracy or decreasing “With a focus on real-
prediction error. But this approach often overlooks the world examples, careful
importance of understanding why and how your ML model consideration of trade-
makes the predictions that it does. offs, and deep science
interleaved with practical
Explainability methods provide an essential toolkit for better
code, this book is a
understanding model behavior, and this practical guide brings
gentle yet comprehensive
together best-in-class techniques for model explainability.
introduction to model
Experienced machine learning engineers and data scientists
explainability.”
will learn hands-on how these techniques work so that you’ll be —Harsha Nori
able to apply these tools more easily in your daily workflow. Engineering Manager,
Responsible AI at Microsoft Research
This essential book provides:
• A detailed look at some of the most useful and commonly “This book uniquely
used explainability techniques, highlighting pros and cons to embraces a utilitarian
help you choose the best tool for your needs approach with an
• Tips and best practices for implementing these techniques emphasis on the human
element to complement
• A guide to interacting with explainability and how to avoid
the algorithms. A
common pitfalls
must-read for all ML
• The knowledge you need to incorporate explainability in practitioners.”
your ML workflow to help build more robust ML systems —Salem Haykal
Area Tech Lead / GCP Cloud AI
• Advice about Explainable AI techniques, including how to & Industry Solutions, Alphabet/GCP
apply techniques to models that consume tabular, image, or
text data
Michael Munn is a research software
• Example implementation code in Python using well-
Munn & Pitman
engineer at Google. His work focuses on
known explainability libraries for models built in Keras and better understanding the mathematical
TensorFlow 2.0, PyTorch, and HuggingFace foundations of machine learning.
David Pitman is a staff engineer working
in Google Cloud on the AI Platform,
where he leads the Explainable AI team.
MACHINE LEARNING Twitter: @oreillymedia
linkedin.com/company/oreilly-media
US $69.99 CAN $87.99 youtube.com/oreillymedia
ISBN: 978-1-098-11913-3
,Explainable AI for Practitioners
Designing and Implementing
Explainable ML Solutions
Michael Munn and David Pitman
Foreword by Ankur Taly
Beijing Boston Farnham Sebastopol Tokyo
, Explainable AI for Practitioners
by Michael Munn and David Pitman
Copyright © 2023 Michael Munn, David Pitman, and O’Reilly Media, Inc. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://oreilly.com). For more information, contact our corporate/institutional
sales department: 800-998-9938 or .
Acquisitions Editor: Nicole Butterfield Indexer: nSight, Inc.
Development Editor: Rita Fernando Interior Designer: David Futato
Production Editor: Jonathon Owen Cover Designer: Karen Montgomery
Copyeditor: nSight, Inc. Illustrator: Kate Dullea
Proofreader: Piper Editorial Consulting, LLC
November 2022: First Edition
Revision History for the First Edition
2022-11-28: First Release
See https://oreil.ly/explainable-ai for release details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Explainable AI for Practitioners, the
cover image, and related trade dress are trademarks of O’Reilly Media, Inc.
The views expressed in this work are those of the authors, and do not represent the publisher’s views.
While the publisher and the authors have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the authors disclaim all responsibility
for errors or omissions, including without limitation responsibility for damages resulting from the use
of or reliance on this work. Use of the information and instructions contained in this work is at your
own risk. If any code samples or other technology this work contains or describes is subject to open
source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use
thereof complies with such licenses and/or rights.
978-1-098-11913-3
[LSI]
for Practitioners
Designing and Implementing
Explainable ML Solutions
Michael Munn &
David Pitman
Foreword by Ankur Taly
,Explainable AI for Practitioners
Most intermediate-level machine learning books focus on
how to optimize models by increasing accuracy or decreasing “With a focus on real-
prediction error. But this approach often overlooks the world examples, careful
importance of understanding why and how your ML model consideration of trade-
makes the predictions that it does. offs, and deep science
interleaved with practical
Explainability methods provide an essential toolkit for better
code, this book is a
understanding model behavior, and this practical guide brings
gentle yet comprehensive
together best-in-class techniques for model explainability.
introduction to model
Experienced machine learning engineers and data scientists
explainability.”
will learn hands-on how these techniques work so that you’ll be —Harsha Nori
able to apply these tools more easily in your daily workflow. Engineering Manager,
Responsible AI at Microsoft Research
This essential book provides:
• A detailed look at some of the most useful and commonly “This book uniquely
used explainability techniques, highlighting pros and cons to embraces a utilitarian
help you choose the best tool for your needs approach with an
• Tips and best practices for implementing these techniques emphasis on the human
element to complement
• A guide to interacting with explainability and how to avoid
the algorithms. A
common pitfalls
must-read for all ML
• The knowledge you need to incorporate explainability in practitioners.”
your ML workflow to help build more robust ML systems —Salem Haykal
Area Tech Lead / GCP Cloud AI
• Advice about Explainable AI techniques, including how to & Industry Solutions, Alphabet/GCP
apply techniques to models that consume tabular, image, or
text data
Michael Munn is a research software
• Example implementation code in Python using well-
Munn & Pitman
engineer at Google. His work focuses on
known explainability libraries for models built in Keras and better understanding the mathematical
TensorFlow 2.0, PyTorch, and HuggingFace foundations of machine learning.
David Pitman is a staff engineer working
in Google Cloud on the AI Platform,
where he leads the Explainable AI team.
MACHINE LEARNING Twitter: @oreillymedia
linkedin.com/company/oreilly-media
US $69.99 CAN $87.99 youtube.com/oreillymedia
ISBN: 978-1-098-11913-3
,Explainable AI for Practitioners
Designing and Implementing
Explainable ML Solutions
Michael Munn and David Pitman
Foreword by Ankur Taly
Beijing Boston Farnham Sebastopol Tokyo
, Explainable AI for Practitioners
by Michael Munn and David Pitman
Copyright © 2023 Michael Munn, David Pitman, and O’Reilly Media, Inc. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://oreilly.com). For more information, contact our corporate/institutional
sales department: 800-998-9938 or .
Acquisitions Editor: Nicole Butterfield Indexer: nSight, Inc.
Development Editor: Rita Fernando Interior Designer: David Futato
Production Editor: Jonathon Owen Cover Designer: Karen Montgomery
Copyeditor: nSight, Inc. Illustrator: Kate Dullea
Proofreader: Piper Editorial Consulting, LLC
November 2022: First Edition
Revision History for the First Edition
2022-11-28: First Release
See https://oreil.ly/explainable-ai for release details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Explainable AI for Practitioners, the
cover image, and related trade dress are trademarks of O’Reilly Media, Inc.
The views expressed in this work are those of the authors, and do not represent the publisher’s views.
While the publisher and the authors have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the authors disclaim all responsibility
for errors or omissions, including without limitation responsibility for damages resulting from the use
of or reliance on this work. Use of the information and instructions contained in this work is at your
own risk. If any code samples or other technology this work contains or describes is subject to open
source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use
thereof complies with such licenses and/or rights.
978-1-098-11913-3
[LSI]