The preparation
You can find the code for this example here: https://github.com/PacktPublishing/Interpretable-Machine-Learning-with-Python/blob/master/Chapter09/Traffic.ipynb.
Loading the libraries
To run this example, you will need to install the following libraries:
mldatasets
to load the datasetpandas
andnumpy
to manipulate the datasettensorflow
to load the modelstatsmodels
,sklearn
(scikit-learn),matplotlib
,seaborn
,alibi
,distython
,shap
, andSALib
to create and visualize the interpretations
You should load all of them first:
import math import os import mldatasets import pandas as pd import numpy as np import tensorflow as tf from tensorflow import keras from tensorflow.keras.preprocessing.sequence import TimeseriesGenerator from keras.utils.data_utils import get_file from sklearn.preprocessing import MinMaxScaler from sklearn import metrics from statsmodels.tsa.seasonal import seasonal_decompose from statsmodels.tsa.stattools import...