该书与第一版相比有很大改动
Table of Contents
Preface 1
Chapter 1: Getting Started with Deep Learning 7
What is deep learning? 8
A conceptual overview of neural networks 10
Neural networks as an extension of linear regression 10
Neural networks as a network of memory cells 17
Deep neural networks 19
Some common myths about deep learning 21
Setting up your R environment 23
Deep learning frameworks for R 26
MXNet 26
Keras 27
Do I need a GPU (and what is it, anyway)? 28
Setting up reproducible results 29
Summary 31
Chapter 2: Training a Prediction Model 32
Neural networks in R 33
Building neural network models 33
Generating predictions from a neural network 48
The problem of overfitting data – the consequences explained 50
Use case – building and applying a neural network 53
Summary 58
Chapter 3: Deep Learning Fundamentals 60
Building neural networks from scratch in R 61
Neural network web application 61
Neural network code 72
Back to deep learning 77
The symbol, X, y, and ctx parameters 78
The num.round and begin.round parameters 78
The optimizer parameter 78
The initializer parameter 79
The eval.metric and eval.data parameters 79
The epoch.end.callback parameter 80
The array.batch.size parameter 80
Using regularization to overcome overfitting 81
L1 penalty 81
L1 penalty in action 82
L2 penalty 84
Table of Contents
[ ii ]
L2 penalty in action 85
Weight decay (L2 penalty in neural networks) 86
Ensembles and model-averaging 89
Use case – improving out-of-sample model performance using
dropout 91
Summary 96
Chapter 4: Training Deep Prediction Models 97
Getting started with deep feedforward neural networks 97
Activation functions 99
Introduction to the MXNet deep learning library 100
Deep learning layers 104
Building a deep learning model 105
Use case – using MXNet for classification and regression 108
Data download and exploration 108
Preparing the data for our models 113
The binary classification model 117
The regression model 122
Improving the binary classification model 125
The unreasonable effectiveness of data 129
Summary 130
Chapter 5: Image Classification Using Convolutional Neural Networks 132
CNNs 133
Convolutional layers 134
Pooling layers 143
Dropout 144
Flatten layers, dense layers, and softmax 146
Image classification using the MXNet library 148
Base model (no convolutional layers) 151
LeNet 153
Classification using the fashion MNIST dataset 156
References/further reading 160
Summary 161
Chapter 6: Tuning and Optimizing Models 162
Evaluation metrics and evaluating performance 163
Types of evaluation metric 163
Evaluating performance 164
Data preparation 167
Different data distributions 168
Data partition between training, test, and validation sets 171
Standardization 172
Data leakage 173
Data augmentation 173
Using data augmentation to increase the training data 174
Table of Contents
[ iii ]
Test time augmentation 178
Using data augmentation in deep learning libraries 180
Tuning hyperparameters 180
Grid search 181
Random search 182
Use case—using LIME for interpretability 184
Model interpretability with LIME 187
Summary 192
Chapter 7: Natural Language Processing Using Deep Learning 193
Document classification 194
The Reuters dataset 194
Traditional text classification 196
Deep learning text classification 202
Word vectors 204
Comparing traditional text classification and deep learning 206
Advanced deep learning text classification 210
1D convolutional neural network model 210
Recurrent neural network model 212
Long short term memory model 214
Gated Recurrent Units model 216
Bidirectional LSTM model 218
Stacked bidirectional model 219
Bidirectional with 1D convolutional neural network model 221
Comparing the deep learning NLP architectures 222
Summary 223
Chapter 8: Deep Learning Models Using TensorFlow in R 224
Introduction to the TensorFlow library 224
Using TensorBoard to visualize deep learning networks 226
TensorFlow models 232
Linear regression using TensorFlow 233
Convolutional neural networks using TensorFlow 234
TensorFlow estimators and TensorFlow runs packages 239
TensorFlow estimators 239
TensorFlow runs package 244
Summary 247
Chapter 9: Anomaly Detection and Recommendation Systems 248
What is unsupervised learning? 249
How do auto-encoders work? 250
Regularized auto-encoders 251
Penalized auto-encoders 251
Denoising auto-encoders 252
Training an auto-encoder in R 253
Accessing the features of the auto-encoder model 258
Table of Contents
[ iv ]
Using auto-encoders for anomaly detection 260
Use case – collaborative filtering 265
Preparing the data 266
Building a collaborative filtering model 269
Building a deep learning collaborative filtering model 270
Applying the deep learning model to a business problem 273
Summary 276
Chapter 10: Running Deep Learning Models in the Cloud 277
Setting up a local computer for deep learning 278
How do I know if my model is training on a GPU? 281
Using AWS for deep learning 282
A brief introduction to AWS 282
Creating a deep learning GPU instance in AWS 286
Creating a deep learning AMI in AWS 301
Using Azure for deep learning 304
Using Google Cloud for deep learning 312
Using Paperspace for deep learning 317
Summary 319
Chapter 11: The Next Level in Deep Learning 321
Image classification models 322
Building a complete image classification solution 322
Creating the image data 322
Building the deep learning model 326
Using the saved deep learning model 330
The ImageNet dataset 332
Loading an existing model 333
Transfer learning 336
Deploying TensorFlow models 340
Other deep learning topics 344
Generative adversarial networks 345
Reinforcement learning 346
Additional deep learning resources 350
Summary 352
Other Books You May Enjoy 353
Index 356