ENGLISH

Interpretable Machine Learning with Python: Learn to build interpretable high-performance models with hands-on real-world examples

Book information

Publisher
Packt Publishing
Year
2021
ISBN
180020390X, 9781800203907
Language
english
Format
PDF
Filesize
15 MB (16141623 bytes)
Pages
736\737
Time added
2021-11-10 13:23:45

Description

Understand the key aspects and challenges of machine learning interpretability, learn how to overcome them with interpretation methods, and leverage them to build fairer, safer, and more reliable models Key FeaturesLearn how to extract easy-to-understand insights from any machine learning modelBecome well-versed with interpretability techniques to build fairer, safer, and more reliable modelsMitigate risks in AI systems before they have broader implications by learning how to debug black-box modelsBook Description Do you want to understand your models and mitigate risks associated with poor predictions using machine learning (ML) interpretation? Interpretable Machine Learning with Python can help you work effectively with ML models. 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. You'll focus on how white-box models work, compare them to black-box and glass-box models, and examine their trade-off. The second section will 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, the book also helps the reader to interpret model outcomes using examples. 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. 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. What you will learnRecognize the importance of interpretability in businessStudy models that are intrinsically interpretable such as linear models, decision trees, and Naive BayesBecome well-versed in interpreting models with model-agnostic methodsVisualize how an image classifier works and what it learnsUnderstand how to mitigate the influence of bias in datasetsDiscover how to make models more reliable with adversarial robustnessUse monotonic constraints to make fairer and safer modelsWho this book is for This book is for data scientists, machine learning developers, and data stewards who have an increasingly critical responsibility to explain how the AI systems they develop work, their impact on decision making, and how they identify and manage bias. Working knowledge of machine learning and the Python programming language is expected. Table of ContentsInterpretation, Interpretability and Explainability; and why does it all matter?Key Concepts of InterpretabilityInterpretation ChallengesFundamentals of Feature Importance and ImpactGlobal Model-Agnostic Interpretation MethodsLocal Model-Agnostic Interpretation MethodsAnchor and Counterfactual ExplanationsVisualizing Convolutional Neural NetworksInterpretation Methods for Multivariate Forecasting and Sensitivity AnalysisFeature Selection and Engineering for InterpretabilityBias Mitigation and Causal Inference MethodsMonotonic Constraints and Model Tuning for InterpretabilityAdversarial RobustnessWhat's Next for Machine Learning Interpretability? Cover Title Page Copyright and Credits Contributors Table of Contents Preface Section 1: Introduction to Machine Learning Interpretation Chapter 1: Interpretation, Interpretability, and Explainability; and Why Does It All Matter? Technical requirements What is machine learning interpretation? Understanding a simple weight prediction model Understanding the difference between interpretability and explainability What is interpretability? What is explainability? A business case for interpretability Better decisions More trusted brands More ethical More profitable Summary Image sources Further reading Chapter 2: Key Concepts of Interpretability Technical requirements The mission Details about CVD The approach Preparations Loading the libraries Understanding and preparing the data Learning about interpretation method types and scopes Model interpretability method types Model interpretability scopes Interpreting individual predictions with logistic regression Appreciating what hinders machine learning interpretability Non-linearity Interactivity Non-monotonicity Mission accomplished Summary Further reading Chapter 3: Interpretation Challenges Technical requirements The mission The approach The preparations Loading the libraries Understanding and preparing the data Reviewing traditional model interpretation methods Predicting minutes delayed with various regression methods Classifying flights as delayed or not delayed with various classification methods Visualizing delayed flights with dimensionality reduction methods Understanding limitations of traditional model interpretation methods Studying intrinsically interpretable (white-box) models Generalized Linear Models (GLMs) Decision trees RuleFit Nearest neighbors Naïve Bayes Recognizing the trade-off between performance and interpretability Special model properties Assessing performance Discovering newer interpretable (glass-box) models Explainable Boosting Machine (EBM) Skoped Rules Mission accomplished Summary Dataset sources Further reading Section 2: Mastering Interpretation Methods Chapter 4: Fundamentals of Feature Importance and Impact Technical requirements The mission Personality and birth order The approach The preparations Loading the libraries Understanding and preparing the data Measuring the impact of a feature on the outcome Feature importance for tree-based models Feature importance for Logistic Regression Feature importance for LDA Feature importance for the Multi-layer Perceptron Practicing PFI Disadvantages of PFI Interpreting PDPs Interaction PDPs Disadvantages of PDP Explaining ICE plots Disadvantages of ICE Mission accomplished Summary Dataset sources Further reading Chapter 5: Global Model-Agnostic Interpretation Methods Technical requirements The mission The approach The preparations Loading the libraries Understanding and preparing the data Learning about Shapley values Interpreting SHAP summary and dependence plots Generating SHAP summary plots Understanding interactions SHAP dependence plots SHAP force plots Accumulated Local Effects (ALE) plots Global surrogates Mission accomplished Summary Further reading Chapter 6: Local Model-Agnostic Interpretation Methods Technical requirements The mission The approach The preparations Loading the libraries Understanding and preparing the data Leveraging SHAP's KernelExplainer for local interpretations with SHAP values Employing LIME Using LIME for NLP Trying SHAP for NLP Comparing SHAP with LIME Mission accomplished Summary Dataset sources Further reading Chapter 7: Anchor and Counterfactual Explanations Technical requirements The mission Unfair bias in recidivisim risk assessments The approach The preparations Loading the libraries Understanding and preparing the data Understanding anchor explanations Preparations for anchor and counterfactual explanations with alibi Local interpretations for anchor explanations Exploring counterfactual explanations Counterfactual explanations guided by prototypes Counterfactual instances and much more with the What-If Tool (WIT) Comparing with CEM Mission accomplished Summary Dataset sources Further reading Chapter 8: Visualizing Convolutional Neural Networks Technical requirements The mission The approach Preparations Loading the libraries Understanding and preparing the data Assessing the CNN classifier with traditional interpretation methods Visualizing the learning process with activation-based methods Intermediate activations Activation maximization Evaluating misclassifications with gradient-based attribution methods Saliency maps Grad-CAM Integrated gradients Tying it all together Understanding classifications with perturbation-based attribution methods Occlusion sensitivity LIME's ImageExplainer CEM Tying it all together Bonus method: SHAP's DeepExplainer Mission accomplished Summary Dataset and image sources Further reading Chapter 9: Interpretation Methods for Multivariate Forecasting and Sensitivity Analysis Technical requirements The mission The approach The preparation Loading the libraries Understanding and preparing the data Assessing time series models with traditional interpretation methods Generating LSTM attributions with integrated gradients Computing global and local attributions with SHAP's KernelExplainer Identifying influential features with factor prioritization Quantifying uncertainty and cost sensitivity with factor fixing Mission accomplished Summary Dataset and image sources References Section 3:Tuning for Interpretability Chapter 10: Feature Selection and Engineering for Interpretability Technical requirements The mission The approach The preparations Loading the libraries Understanding and preparing the data Understanding the effect of irrelevant features Reviewing filter-based feature selection methods Basic filter-based methods Correlation filter-based methods Ranking filter-based methods Comparing filter-based methods Exploring embedded feature selection methods Discovering wrapper, hybrid, and advanced feature selection methods Wrapper methods Hybrid methods Advanced methods Evaluating all feature-selected models Considering feature engineering Mission accomplished Summary Dataset sources Further reading Chapter 11: Bias Mitigation and Causal Inference Methods Technical requirements The mission The approach The preparations Loading the libraries Understanding and preparing the data Detecting bias Visualizing dataset bias Quantifying dataset bias Quantifying model bias Mitigating bias Pre-processing bias mitigation methods In-processing bias mitigation methods Post-processing bias mitigation methods Tying it all together! Creating a causal model Understanding the results of the experiment Understanding causal models Initializing the linear doubly robust learner Fitting the causal model Understanding heterogeneous treatment effects Choosing policies Testing estimate robustness Adding random common cause Replacing treatment with a random variable Mission accomplished Summary Dataset sources Further reading Chapter 12: Monotonic Constraints and Model Tuning for Interpretability Technical requirements The mission The approach The preparations Loading the libraries Understanding and preparing the data Placing guardrails with feature engineering Ordinalization Discretization Interaction terms and non-linear transformations Categorical encoding Other preparations Tuning models for interpretability Tuning a Keras neural network Tuning other popular model classes Optimizing for fairness with Bayesian hyperparameter tuning and custom metrics Implementing model constraints Mission accomplished Summary Dataset sources Further reading Chapter 13: Adversarial Robustness Technical requirements The mission The approach The preparations Loading the libraries Understanding and preparing the data Loading the CNN base model Assessing the CNN base classifier Learning about evasion attacks Defending against targeted attacks with preprocessing Shielding against any evasion attack via adversarial training of a robust classifier Evaluating and certifying adversarial robustness Comparing model robustness with attack strength Certifying robustness with randomized smoothing Mission accomplished Summary Dataset sources Further reading Chapter 14: What's Next for Machine Learning Interpretability? Understanding the current landscape of ML interpretability Tying everything together! Current trends Speculating on the future of ML interpretability A new vision for ML A multidisciplinary approach Adequate standardization  Enforcing regulation Seamless machine learning automation with built-in interpretation Tighter integration with MLOps engineers Further reading Why subscribe? Other Books You May Enjoy Index

Similar books