Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Interpretable Machine Learning with Python
Interpretable Machine Learning with Python

Interpretable Machine Learning with Python: Build explainable, fair, and robust high-performance models with hands-on, real-world examples , Second Edition

eBook
€26.98 €29.99
Paperback
€37.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Interpretable Machine Learning with Python

Key Concepts of Interpretability

This book covers many model interpretation methods. Some produce metrics, others create visuals, and some do both; some depict models broadly and others granularly. In this chapter, we will learn about two methods, feature importance and decision regions, as well as the taxonomies used to describe these methods. We will also detail what elements hinder machine learning interpretability as a primer to what lies ahead.

The following are the main topics we are going to cover in this chapter:

  • Learning about interpretation method types and scopes
  • Appreciating what hinders machine learning interpretability

Let’s start with our technical requirements.

Technical requirements

Although we began the book with a “toy example,” we will be leveraging real datasets throughout this book to be used in specific interpretation use cases. These come from many different sources and are often used only once.

To avoid that, readers spend a lot of time downloading, loading, and preparing datasets for single examples; there’s a library called mldatasets that takes care of most of this. Instructions on how to install this library are located in the Preface. In addition to mldatasets, this chapter’s examples also use the pandas, numpy, statsmodel, sklearn, seaborn, and matplotlib libraries.

The code for this chapter is located here: https://packt.link/DgnVj.

The mission

Imagine you are an analyst for a national health ministry, and there’s a Cardiovascular Diseases (CVDs) epidemic. The minister has made it a priority to reverse the growth and reduce the caseload to a 20-year low. To this end, a task force has been created to find clues in the data to ascertain the following:

  • What risk factors can be addressed.
  • If future cases can be predicted, interpret predictions on a case-by-case basis.

You are part of this task force!

Details about CVD

Before we dive into the data, we must gather some important details about CVD in order to do the following:

  • Understand the problem’s context and relevance.
  • Extract domain knowledge information that can inform our data analysis and model interpretation.
  • Relate an expert-informed background to a dataset’s features.

CVDs are a group of disorders, the most common of which is coronary heart disease (also known as Ischaemic Heart Disease). According to the World Health Organization, CVD is the leading cause of death globally, killing close to 18 million people annually. Coronary heart disease and strokes (which are, for the most part, a byproduct of CVD) are the most significant contributors to that. It is estimated that 80% of CVD is made up of modifiable risk factors. In other words, some of the preventable factors that cause CVD include the following:

  • Poor diet
  • Smoking and alcohol consumption habits
  • Obesity
  • Lack of physical activity
  • Poor sleep

Also, many of the risk factors are non-modifiable and, therefore, known to be unavoidable, including the following:

  • Genetic predisposition
  • Old age
  • Male (varies with age)

We won’t go into more domain-specific details about CVD because it is not required to make sense of the example. However, it can’t be stressed enough how central domain knowledge is to model interpretation. So, if this example was your job and many lives depended on your analysis, it would be advisable to read the latest scientific research on the subject and consult with domain experts to inform your interpretations.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Interpret real-world data, including cardiovascular disease data and the COMPAS recidivism scores
  • Build your interpretability toolkit with global, local, model-agnostic, and model-specific methods
  • Analyze and extract insights from complex models from CNNs to BERT to time series models

Description

Interpretable Machine Learning with Python, Second Edition, brings to light the key concepts of interpreting machine learning models by analyzing real-world data, providing you with a wide range of skills and tools to decipher the results of even the most complex models. Build your interpretability toolkit with several use cases, from flight delay prediction to waste classification to COMPAS risk assessment scores. This book is full of useful techniques, introducing them to the right use case. Learn traditional methods, such as feature importance and partial dependence plots to integrated gradients for NLP interpretations and gradient-based attribution methods, such as saliency maps. In addition to the step-by-step code, 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 the book, you’ll be confident in tackling interpretability challenges with black-box models using tabular, language, image, and time series data.

Who is this book for?

This book is for data scientists, machine learning developers, machine learning engineers, MLOps engineers, and data stewards who have an increasingly critical responsibility to explain how the artificial intelligence systems they develop work, their impact on decision making, and how they identify and manage bias. It’s also a useful resource for self-taught ML enthusiasts and beginners who want to go deeper into the subject matter, though a good grasp of the Python programming language is needed to implement the examples.

What you will learn

  • Progress from basic to advanced techniques, such as causal inference and quantifying uncertainty
  • Build your skillset from analyzing linear and logistic models to complex ones, such as CatBoost, CNNs, and NLP transformers
  • Use monotonic and interaction constraints to make fairer and safer models
  • Understand how to mitigate the influence of bias in datasets
  • Leverage sensitivity analysis factor prioritization and factor fixing for any model
  • Discover how to make models more reliable with adversarial robustness

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Oct 31, 2023
Length: 606 pages
Edition : 2nd
Language : English
ISBN-13 : 9781803243627
Category :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Oct 31, 2023
Length: 606 pages
Edition : 2nd
Language : English
ISBN-13 : 9781803243627
Category :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 105.97
Causal Inference and Discovery in Python
€29.99
Interpretable Machine Learning with Python
€37.99
Machine Learning Engineering  with Python
€37.99
Total 105.97 Stars icon

Table of Contents

16 Chapters
Interpretation, Interpretability, and Explainability; and Why Does It All Matter? Chevron down icon Chevron up icon
Key Concepts of Interpretability Chevron down icon Chevron up icon
Interpretation Challenges Chevron down icon Chevron up icon
Global Model-Agnostic Interpretation Methods Chevron down icon Chevron up icon
Local Model-Agnostic Interpretation Methods Chevron down icon Chevron up icon
Anchors and Counterfactual Explanations Chevron down icon Chevron up icon
Visualizing Convolutional Neural Networks Chevron down icon Chevron up icon
Interpreting NLP Transformers Chevron down icon Chevron up icon
Interpretation Methods for Multivariate Forecasting and Sensitivity Analysis Chevron down icon Chevron up icon
Feature Selection and Engineering for Interpretability Chevron down icon Chevron up icon
Bias Mitigation and Causal Inference Methods Chevron down icon Chevron up icon
Monotonic Constraints and Model Tuning for Interpretability Chevron down icon Chevron up icon
Adversarial Robustness Chevron down icon Chevron up icon
What’s Next for Machine Learning Interpretability? Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.9
(21 Ratings)
5 star 90.5%
4 star 4.8%
3 star 4.8%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Patrick Dec 08, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
came across this years ago but found the libraries to hard to install (great book though)... excited to see the setup.py file, and that it appears to be working well
Subscriber review Packt
Valdez ladd Feb 13, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book has well written knowledge and resources for this subject. Hard to find so much structured information in one source. Thank you.
Feefo Verified review Feefo
Juan Sebastian Roa Dec 09, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book provides a clear and practical guide to demystifying complex ML models. The book adeptly navigates through interpretability techniques, making them accessible to both beginners and seasoned practitioners. Serg skillfully balances theory with real-world applications, making this a valuable resource for anyone seeking a deeper understanding of model transparency in the ML landscape.Bonus: there's a GitHub repository with all Python exercises covered in each chapter, making it hands-on and practical.
Amazon Verified review Amazon
Ram Seshadri Jan 07, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book can be compared to a new pair of shades. After you read it, you will look at all your pre-built and yet to be trained models in entirely new light! I guarantee it.When this book came out, I actually thought I knew its subject matter well. Alas how naive I was! After reading the first two chapters of “Interpretable Machine Learning by Python” by Serg Masis it was clear to me that my entire knowledge of interpretable ML could be compressed in just those 2 chapters. There were still 12 more chapters and over 500 more pages to go! Thats how little I knew of Interpretable ML. So you can imagine my astonishment when the more I read this book, the more I had to put it down and actually try some of the fantastic code examples that Serg had put together to learn how to look at the models I had built in new ways. It was like have a cool new pair of shades that you wear around not just to impress friends but also to look at old places in new filters.Interpretable ML is the holy grail of all practitioners in this “magic art” we call ML. It’s what every Data Scientist hopes to do after building their best performing machine learning model. But many of them do not know how because they may have built a black box model, while hoping that they would discover tools later to explain how the model actually worked. Luckily for such a data scientist, a book like the one that Serg Masis has created will immensely help.Serg Has painstakingly put together what i believe is a “tour de force” that will find a place in every data scientist’s book shelf. This is a must have book if you want to stand out as a data scientist in your organization or group. Let me tell you why.While most books on interpretable ML focus on techniques, such as shop and lime, they do not help you understand the huge amount of context and learnings needed to apply them effectively to your use case. Serg shows you how by taking real world datasets with 10K or even a million samples and And breaks down each one of them, showing you how to build models, as well as break them apart to reveal what they have learned and how they could be understood by non-technical users. This is a key skill that you have to master as a data scientist. For that alone, this book is worth the money.I learned so much about the wealth of techniques that were available for interrogating models that ranged from the simplest linear model to the most complex transformers we see today. I also found new models such as RuleFit and new techniques like Saliency Maps that I had never heard of. Serg never tires of bringing newer and newer lenses to examining your models!Let me warn however about the size and scope of this book. I thought I would be able to finish the book in a couple of sittings during the Holiday break. I was wrong. It took me two whole weeks to read it to fully understand it. There are so many nuances and code examples that you must sit and try out to really understand it and learn it. This is not for the dilettante in ML. This is for the serious practitioner of ML. But the time you put in will pay you back in spades since more people will listen to you when you explain how your models work which is a critical skill for your success as a data scientist. There you have it! My one line summary of why you should get and read this book!
Amazon Verified review Amazon
Sarbjit Singh Hanjra Jul 29, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I just finished reading "Interpretable Machine Learning with Python - Second Edition" Authored by Serg Masís and published by Packt.In the book, readers embark on a comprehensive journey through the intricate world of interpreting machine learning models. Authored with technical precision and practical insights, the book addresses the pressing need for understanding and explaining machine learning algorithms.The initial chapters lay a sturdy foundation, delineating the distinctions between interpretability and explainability while underscoring their significance in real-world applications. Through a compelling business case, readers grasp the imperative of interpretability in decision-making processes.Delving deeper, the book navigates through key concepts and challenges surrounding interpretation methodologies. From traditional model interpretations to the emergence of newer glass-box models, readers gain a nuanced understanding of interpretability paradigms.The narrative unfolds with an exploration of global and local model-agnostic interpretation methods, shedding light on feature importance and interactions. Anchors, counterfactual explanations, and visualization techniques offer multifaceted insights into model behaviors across various domains.The book extends its reach into the realms of convolutional neural networks (CNNs) and natural language processing (NLP) transformers, elucidating complex architectures through visualization and interpretation methods.Further chapters unravel the intricacies of multivariate forecasting, feature selection, bias mitigation, and causal inference methods, empowering readers to navigate through the interpretability landscape with finesse.Finally, discussions on model tuning, adversarial robustness, and future prospects in ML interpretability invite readers to contemplate the evolving role of transparency in machine learning systems."Interpretable Machine Learning with Python" emerges as an indispensable resource for practitioners, researchers, and enthusiasts alike, offering profound insights and actionable strategies to unravel the mysteries of machine learning models.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.