The preparations
The code for this example can be found at https://github.com/PacktPublishing/Interpretable-Machine-Learning-with-Python-2E/blob/main/10/Mailer.ipynb.
Loading the libraries
To run this example, we need to install the following libraries:
mldatasets
to load the datasetpandas
,numpy
, andscipy
to manipulate itmlxtend
,sklearn-genetic-opt
,xgboost
, andsklearn
(scikit-learn) to fit the modelsmatplotlib
andseaborn
to create and visualize the interpretations
To load the libraries, use the following code block:
import math
import os
import mldatasets
import pandas as pd
import numpy as np
import timeit
from tqdm.notebook import tqdm
from sklearn.feature_selection import VarianceThreshold,\
mutual_info_classif, SelectKBest
from sklearn.feature_selection import SelectFromModel
from sklearn.linear_model import LogisticRegression,\
LassoCV, LassoLarsCV...