Interpretable Machine Learning with Python Build Explainable, Fair, and Robust High-Performance Models with Hands-on, Real-world Examples

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...

Descripción completa

Detalles Bibliográficos
Otros Autores: Masís, Serg, author (author), Molak, Aleksander, author, Rothman, Denis, author
Formato: Libro electrónico
Idioma:Inglés
Publicado: Birmingham, England : Packt Publishing [2021]
Edición:Second edition
Colección:Expert insight.
Materias:
Ver en Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009781236506719
Tabla de Contenidos:
  • Cover
  • Copyright
  • Contributors
  • Table of Contents
  • Preface
  • 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?
  • 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
  • Chapter 2: 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
  • Chapter 3: 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
  • Chapter 4: 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
  • Chapter 5: 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
  • Chapter 6: 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 &amp
  • Fairness
  • Mission accomplished
  • Summary
  • Dataset sources
  • Further reading
  • Chapter 7: 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
  • Chapter 8: 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
  • 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
  • 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
  • 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
  • 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
  • Chapter 11: Bias Mitigation and Causal Inference Methods
  • Technical requirements
  • The mission
  • The approach.
  • The preparations.