The preparations
You will find the code for this example here: https://github.com/PacktPublishing/Interpretable-Machine-Learning-with-Python-2E/tree/main/13/Masks.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:
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 matplotlib.pyplot as plt
import seaborn as sns
from sklearn import metrics
from art.estimators.classification import KerasClassifier
from art.attacks.evasion import FastGradientMethod,\
ProjectedGradientDescent, BasicIterativeMethod
from...