Book Image

Interpretable Machine Learning with Python

By : Serg Masís
Book Image

Interpretable Machine Learning with Python

By: Serg Masís

Overview of this book

Do you want to gain a deeper understanding of your models and better mitigate poor prediction risks associated with machine learning interpretation? If so, then Interpretable Machine Learning with Python deserves a place on your bookshelf. We’ll be starting off with the fundamentals of interpretability, its relevance in business, and exploring its key aspects and challenges. As you progress through the chapters, you'll then focus on how white-box models work, compare them to black-box and glass-box models, and examine their trade-off. You’ll also get you up to speed with a vast array of interpretation methods, also known as Explainable AI (XAI) methods, and how to apply them to different use cases, be it for classification or regression, for tabular, time-series, image or text. In addition to the step-by-step code, this book will also help you interpret model outcomes using examples. You’ll get hands-on with tuning models and training data for interpretability by reducing complexity, mitigating bias, placing guardrails, and enhancing reliability. The methods you’ll explore here range from state-of-the-art feature selection and dataset debiasing methods to monotonic constraints and adversarial retraining. By the end of this book, you'll be able to understand ML models better and enhance them through interpretability tuning.
Table of Contents (19 chapters)
1
Section 1: Introduction to Machine Learning Interpretation
5
Section 2: Mastering Interpretation Methods
12
Section 3:Tuning for Interpretability

Preface

From this book's title, you can infer that this book is about three things: Interpretation, Machine Learning, and Python. And they are precisely in that order of importance!

"Why?", you might ask.

Interpretable Machine Learning, also known as Explainable AI (XAI), is an ever-increasing family of methods that we can leverage to learn from models and make them safe, fair, and reliable, which is something, I hope, we all want for our models.

However, since AI is replacing software (and humans), machine learning models are seen as a more "intelligent" form of software. Yes, they are ones and zeros, but they are not software in the sense that their logic is programmed by people and does as intended, by design. So, interpretation is how we can make sense of them and their mistakes, then correct their flaws, hopefully before they cause any harm. Hence, interpretation is critical to make models trustworthy, and ethical. Also, soon enough, we won't even train models with code, but with drag-and-drop interfaces! So, while we all love Python, the skill that will stand the test of time is machine learning interpretation.

For now, it still takes ample code to prepare and explore data and then train and productionize models, so every chapter in this book involves detailed Python code examples. Yet, the book wasn't designed to be employed as a programming "cookbook" disconnected from use cases and any sense of purpose. Instead, this book is flipping this paradigm around. The reason for this is simple: For Interpretable Machine Learning to be effective, the "why?" has to precede the "how?". After all, interpretation is all about answering the question "why?".

For this reason, most chapters begin with a mission (the "why?") followed by an approach (the "how?"). After that, the goal is to complete the mission using the methods (more "how?") taught throughout the chapter, focusing on interpreting outcomes (more "why?"). Lastly, it will reflect on what actionable insights were learned completing the task.

The book itself is also structured. It goes from fundamentals to more advanced topics. The tools employed are all open source and built by the most advanced research labs, such as Microsoft, Google, and IBM. It's a very broad area of research, most of which hasn't even left the lab and become widely used. This book has no intention of covering absolutely all of it. Instead, the objective is to present many interpretability tools in sufficient depth to be useful for practitioners and the many professionals involved in the machine learning field.

The first section of the book is a beginner's guide to interpretability, covering its relevance in business and exploring its key aspects and challenges. The second section will get you up to speed with a comprehensive collection of interpretation methods and how to apply them to different use cases, be it for classification or regression, for tabular data, time-series, images, or text. In the third section, you'll get hands-on with tuning models and training data for interpretability by reducing complexity, mitigating bias, placing guardrails, and enhancing reliability.

By the end of this book, you will be employing interpretation methods to understand machine learning models better and improving them through interpretability tuning.