The preparations
You will find the code for this example here: https://github.com/PacktPublishing/Interpretable-Machine-Learning-with-Python-2E/tree/main/04/UsedCars.ipynb
Loading the libraries
To run this example, you need to install the following libraries:
mldatasetsto load the datasetpandasandnumpyto manipulate itsklearn(scikit-learn) andcatboostto load and configure the modelmatplotlib,seaborn,shap,pdpbox, andpyaleto generate and visualize the model interpretations
You should load all of them first:
import math
import os, random
import numpy as np
import pandas as pd
import mldatasets
from sklearn import metrics, ensemble, tree, inspection,\
model_selection
import catboost as cb
import matplotlib.pyplot as plt
import seaborn as sns
import shap
from pdpbox import pdp, info_plots
from PyALE import ale
from lime.lime_tabular import LimeTabularExplainer
The following snippet of code will load...