The preparations
You will find most of the code for this example at https://github.com/PacktPublishing/Interpretable-Machine-Learning-with-Python/tree/master/Chapter13/Masks_part1.ipynb, up to the code used in the Certifying robustness with randomized smoothing section. The code for that section alone is located at https://github.com/PacktPublishing/Interpretable-Machine-Learning-with-Python/tree/master/Chapter13/Masks_part2.ipynb.
Loading the libraries
To run this example, you need to install the following libraries:
mldatasets
to load the datasetnumpy
andsklearn
(scikit-learn) to manipulate ittensorflow
to fit the modelsmatplotlib
andseaborn
to visualize the interpretations
You should load all of them first, as follows:
import math import os import warnings warnings.filterwarnings("ignore") import mldatasets import numpy as np from sklearn import preprocessing import tensorflow as tf from tensorflow.keras.utils import get_file import...