Interpretable Machine Learning with Python - Second Edition: Build explainable, fair, and robust high-performance models with hands-on, real-world examples
معرفی کتاب «Interpretable Machine Learning with Python - Second Edition: Build explainable, fair, and robust high-performance models with hands-on, real-world examples» نوشتهٔ Serg Masis، منتشرشده توسط نشر anonymous در سال 2023. این کتاب در 5 صفحه، فرمت epub، زبان انگلیسی ارائه شده است. «Interpretable Machine Learning with Python - Second Edition: Build explainable, fair, and robust high-performance models with hands-on, real-world examples» در دستهٔ برنامهنویسی قرار دارد.
A deep dive into the key aspects and challenges of machine learning interpretability using a comprehensive toolkit, including SHAP, feature importance, and causal inference, to build fairer, safer, and more reliable models. Purchase of the print or Kindle book includes a free eBook in PDF format. Key Features 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 Book 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. 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 Who this book is 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. Preface Who this book is for What this book covers To get the most out of this book Get in touch 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? Beware of complexity When does interpretability matter? What are black-box models? What are white-box models? What is explainability? Why and when does explainability matter? A business case for interpretability Better decisions More trusted brands More ethical More profitable Summary Image sources Dataset sources Further reading Key Concepts of Interpretability Technical requirements The mission Details about CVD The approach Preparations Loading the libraries Understanding and preparing the data The data dictionary Data preparation 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 Interpretation Challenges Technical requirements The mission The approach The preparations Loading the libraries Understanding and preparing the data The data dictionary Data preparation Reviewing traditional model interpretation methods Predicting minutes delayed with various regression methods Classifying flights as delayed or not delayed with various classification methods Training and evaluating the classification models Understanding limitations of traditional model interpretation methods Studying intrinsically interpretable (white-box) models Generalized Linear Models (GLMs) Linear regression Ridge regression Polynomial regression Logistic regression Decision trees CART decision trees RuleFit Interpretation and feature importance Nearest neighbors k-Nearest Neighbors Naïve Bayes Gaussian Naïve Bayes Recognizing the trade-off between performance and interpretability Special model properties The key property: explainability The remedial property: regularization Assessing performance Discovering newer interpretable (glass-box) models Explainable Boosting Machine (EBM) Global interpretation Local interpretation Performance GAMI-Net Global interpretation Local interpretation Performance Mission accomplished Summary Dataset sources Further reading Global Model-Agnostic Interpretation Methods Technical requirements The mission The approach The preparations Loading the libraries Data preparation Model training and evaluation What is feature importance? Assessing feature importance with model-agnostic methods Permutation feature importance SHAP values Comprehensive explanations with KernelExplainer Faster explanations with TreeExplainer Visualize global explanations SHAP bar plot SHAP beeswarm plot Feature summary explanations Partial dependence plots SHAP scatter plot ALE plots Feature interactions SHAP bar plot with clustering 2D ALE plots PDP interactions plots Mission accomplished Summary Further reading Local Model-Agnostic Interpretation Methods Technical requirements The mission The approach The preparations Loading the libraries Understanding and preparing the data The data dictionary Data preparation Leveraging SHAP’s KernelExplainer for local interpretations with SHAP values Training a C-SVC model Computing SHAP values using KernelExplainer Local interpretation for a group of predictions using decision plots Local interpretation for a single prediction at a time using a force plot Employing LIME What is LIME? Local interpretation for a single prediction at a time using LimeTabularExplainer Using LIME for NLP Training a LightGBM model Local interpretation for a single prediction at a time using LimeTextExplainer Trying SHAP for NLP Comparing SHAP with LIME Mission accomplished Summary Dataset sources Further reading Anchors and Counterfactual Explanations Technical requirements The mission Unfair bias in recidivism risk assessments The approach The preparations Loading the libraries Understanding and preparing the data The data dictionary Examining predictive bias with confusion matrices Data preparation Modeling Getting acquainted with our “instance of interest” 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 WIT Configuring WIT Datapoint editor Performance & Fairness Mission accomplished Summary Dataset sources Further reading Visualizing Convolutional Neural Networks Technical requirements The mission The approach Preparations Loading the libraries Understanding and preparing the data Data preparation Inspect data The CNN models Load the CNN model Assessing the CNN classifier with traditional interpretation methods Determining what misclassifications to focus on Visualizing the learning process with activation-based methods Intermediate activations Evaluating misclassifications with gradient-based attribution methods Saliency maps Guided Grad-CAM Integrated gradients Bonus method: DeepLIFT Tying it all together Understanding classifications with perturbation-based attribution methods Feature ablation Occlusion sensitivity Shapley value sampling KernelSHAP Tying it all together Mission accomplished Summary Further reading Interpreting NLP Transformers Technical requirements The mission The approach The preparations Loading the libraries Understanding and preparing the data The data dictionary Loading the model Visualizing attention with BertViz Plotting all attention with the model view Diving into layer attention with the head view Interpreting token attributions with integrated gradients LIME, counterfactuals, and other possibilities with the LIT Mission accomplished Summary Further reading Interpretation Methods for Multivariate Forecasting and Sensitivity Analysis Technical requirements The mission The approach The preparation Loading the libraries Understanding and preparing the data The data dictionary Understanding the data Data preparation Loading the LSTM model Assessing time series models with traditional interpretation methods Using standard regression metrics Predictive error aggregations Evaluating the model like a classification problem Generating LSTM attributions with integrated gradients Computing global and local attributions with SHAP’s KernelExplainer Why use KernelExplainer? Defining a strategy to get it to work with a multivariate time series model Laying the groundwork for the permutation approximation strategy Computing the SHAP values Identifying influential features with factor prioritization Computing Morris sensitivity indices Analyzing the elementary effects Quantifying uncertainty and cost sensitivity with factor fixing Generating and predicting on Saltelli samples Performing Sobol sensitivity analysis Incorporating a realistic cost function Mission accomplished Summary Dataset and image sources Further reading 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 Creating a base model Evaluating the model Training the base model at different max depths Reviewing filter-based feature selection methods Basic filter-based methods Constant features with a variance threshold Quasi-constant features with value_counts Duplicating features Removing unnecessary features 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 Sequential forward selection (SFS) Hybrid methods Recursive Feature Elimination (RFE) Advanced methods Model-agnostic feature importance Genetic algorithms Evaluating all feature-selected models Considering feature engineering Mission accomplished Summary Dataset sources Further reading Bias Mitigation and Causal Inference Methods Technical requirements The mission The approach The preparations Loading the libraries Understanding and preparing the data The data dictionary Data preparation Detecting bias Visualizing dataset bias Quantifying dataset bias Quantifying model bias Mitigating bias Preprocessing bias mitigation methods The Reweighing method The disparate impact remover method In-processing bias mitigation methods The exponentiated gradient reduction method The gerry fair classifier method Post-processing bias mitigation methods The equalized odds post-processing method The calibrated equalized odds postprocessing method 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 a random common cause Replacing the treatment variable with a random variable Mission accomplished Summary Dataset sources Further reading Monotonic Constraints and Model Tuning for Interpretability Technical requirements The mission The approach The preparations Loading the libraries Understanding and preparing the data Verifying the sampling balance 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 Defining the model and parameters to tune Running the hyperparameter tuning Examining the results Evaluating the best model Tuning other popular model classes A quick introduction to relevant model parameters Batch hyperparameter tuning models Evaluating models by precision Assessing fairness for the highest-performing model Optimizing for fairness with Bayesian hyperparameter tuning and custom metrics Designing a custom metric Running Bayesian hyperparameter tuning Fitting and evaluating a model with the best parameters Examining racial bias through feature importance Implementing model constraints Constraints for XGBoost Setting regularization and constraint parameters Training and evaluating the constrained model Examining constraints Constraints for TensorFlow Lattice Initializing the model and Lattice inputs Building a Keras model with TensorFlow Lattice layers Training and evaluating the model Mission accomplished Summary Dataset sources Further reading 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 Fast gradient sign method attack Carlini and Wagner infinity norm attack Targeted adversarial patch attack Defending against targeted attacks with preprocessing Shielding against any evasion attack by adversarial training of a robust classifier Evaluating adversarial robustness Comparing model robustness with attack strength Mission accomplished Summary Dataset sources Further reading 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 Summary Further reading Other Books You May Enjoy Index A deep and detailed dive into the key aspects and challenges of machine learning interpretability, complete with the know-how on how to overcome and leverage them to build fairer, safer, and more reliable models 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, Second Edition is the book for you. Youll cover the fundamentals of interpretability, its relevance in business, and explore its key aspects and challenges. See how white-box models work, compare them to black-box and glass-box models, and examine their trade-offs. Get 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, tabular data, time-series, images, or text. In addition to the step-by-step code, this book will also help you interpret model outcomes using many examples. Youll get hands-on with tuning models and training data for interpretability by reducing complexity, mitigating bias, placing guardrails, and enhancing reliability. The methods youll explore here range from state-of-the-art feature selection and dataset debiasing methods to monotonic constraints and adversarial retraining. Youll also look under the hood of the latest NLP transformer models using the Language Interpretability Tool. By the end of this book, you'll understand ML models better and enhance them through interpretability tuning. This book is for data scientists, machine learning developers, MLOps engineers, 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 Its 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. (N.B. Additional chapters to be confirmed upon publication 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 Features: Learn how to extract easy-to-understand insights from any machine learning model Become well-versed with interpretability techniques to build fairer, safer, and more reliable models Mitigate risks in AI systems before they have broader implications by learning how to debug black-box models Book 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 Learn: Recognize the importance of interpretability in business Study models that are intrinsically interpretable such a
دانلود کتاب Interpretable Machine Learning with Python - Second Edition: Build explainable, fair, and robust high-performance models with hands-on, real-world examples