🎨
Explainable-AI
  • Explainable AI
  • Preface
  • How to use this book?
  • Contents
  • What is Explainable AI?
  • Why do we need Explainablity?
  • Explainable systems and Black box systems
  • Types of Explainability Techniques
  • Explainable Models
    • Linear Regression
      • Assumptions
      • Model
      • Statistical Interpretation
    • Decision Trees
      • How Do They Work?
      • Creating the model
      • Interpretation
  • Explainability Techniques for Classical ML
    • SHAP (SHapley Additive exPlanations)
    • Surrogate model
    • LIME (Local Interpretable Model-Agnostic Explanations)
    • PDP (Partial Dependence Plot)
    • ICE (Individual Conditional Expectation Plots)
    • ALE (Accumulated Local Effects Plot)
  • Datasets
    • Medical Cost Personal Dataset
    • Telecom Churn Dataset
    • Sales Opportunity Size Dataset
    • Pima Indians Diabetes Dataset
  • Implementation of these techniques on different models
    • Logistic Regression - SHAP
    • Random Forest - LIME
    • GBM - PDP
    • GBM - ICE
    • Deep Learning - Surrogate
  • Future scope
  • Contributors
  • Citing this Book
Powered by GitBook
On this page
  • What is a Random Forest?
  • Making the Model
  • Implementation of Interpretability
  • Visualizations

Was this helpful?

  1. Implementation of these techniques on different models

Random Forest - LIME

PreviousLogistic Regression - SHAPNextGBM - PDP

Last updated 4 years ago

Was this helpful?

What is a Random Forest?

  • Random Forest is an ensemble learning method used for classification and regression

  • Random Forests are a modification of bagging technique that builds a large collection of non-correlated trees and then averages them

  • This technique is sometimes even called "feature bagging".

Making the Model

Dataset: Automotive marketing ; Target: Customer lifetime value

The data is passed through pre-processing and then trained using Scikit learn Library with RandomForestRegressor function.

R2 score: 0.70

Implementation of Interpretability

For this model we will be using LIME for interpretation. In particular, we use the LimeTabularExplainer which is part of the open source lime package.

We feed some data as shown above and then request the explainer to generate an explanation for a particular row. In the code, we have generated an explanation for 4th row and kept a cap on the number of features as 6.

Visualizations

Row Prediction

Positive/Negative Effects

The above plot gives us an idea of the features that impact the prediction positively and negatively. By positive impact, we say that the feature brought the prediction closer to the predicted value. Negative effect implies the feature took the prediction away from the predicted value. The length of the bars also show the impact. Longer the bar, higher the impact.

Individual Feature Values

The above plot shows the feature values for that particular row.

Code Implementation Here
Predicted Customer Lifetime Value