The preparations
You will find the code for this example here: https://github.com/PacktPublishing/Interpretable-Machine-Learning-with-Python-2E/blob/main/12/Recidivism_part2.ipynb
Loading the libraries
To run this example, you need to install the following libraries:
mldatasets
to load the datasetpandas
andnumpy
to manipulate itsklearn
(scikit-learn),xgboost
,lightgbm
,catboost
,tensorflow
,bayes_opt
, andtensorflow_lattice
to split the data and fit the modelsmatplotlib
,seaborn
,scipy
,xai
, andshap
to visualize the interpretations
You should load all of them first, as follows:
import math
import os
import copy
import mldatasets
import pandas as pd
import numpy as np
from sklearn import preprocessing, model_selection, metrics,\
linear_model, svm, neural_network, ensemble
import xgboost as xgb
import lightgbm as lgb
import catboost as cb
import tensorflow as tf
from bayes_opt import BayesianOptimization
import tensorflow_lattice...