The preparations
You will find the code for this example here: https://github.com/PacktPublishing/Interpretable-Machine-Learning-with-Python/blob/master/Chapter05/FuelEfficiency.ipynb.
Loading the libraries
To follow this example, you need to install the following libraries:
mldatasets
to load the datasetpandas
andnumpy
to manipulate itsklearn
(scikit-learn),tensorflow
,xgboost
, andrulefit
to split the data and fit the modelsscipy
to perform statistical testingmatplotlib
,seaborn
,shap
, andalepython
to visualize the interpretations
You should load all of them first:
import math import os import mldatasets import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn import metrics, tree import as tf import tensorflow_docs as tfdocs import tensorflow_docs.plots import xgboost as xgb from rulefit import RuleFit from scipy import stats import matplotlib.pyplot as plt import seaborn as sns import...