The preparations
You will find the code for this example here: https://github.com/PacktPublishing/Interpretable-Machine-Learning-with-Python/blob/master/Chapter07/Recidivism_part1.ipynb.
Loading the libraries
To run this example, you need to install the following libraries:
mldatasets
to load the datasetpandas
andnumpy
to manipulate the datasetsklearn
(scikit-learn),catboost
, andtensorflow
to split the data and fit the modelsmatplotlib
,seaborn
,alibi
,shap
, andwitwidget
to visualize the interpretations
You should load all of them first:
import math import mldatasets import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn import metrics from catboost import CatBoostClassifier import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers import matplotlib.pyplot as plt import seaborn as sns from alibi.utils.mapping import ohe_to_ord, ord_to_ohe from alibi.explainers...