Book Image

Deep Learning with TensorFlow 2 and Keras - Second Edition

By : Antonio Gulli, Amita Kapoor, Sujit Pal
Book Image

Deep Learning with TensorFlow 2 and Keras - Second Edition

By: Antonio Gulli, Amita Kapoor, Sujit Pal

Overview of this book

Deep Learning with TensorFlow 2 and Keras, Second Edition teaches neural networks and deep learning techniques alongside TensorFlow (TF) and Keras. You’ll learn how to write deep learning applications in the most powerful, popular, and scalable machine learning stack available. TensorFlow is the machine learning library of choice for professional applications, while Keras offers a simple and powerful Python API for accessing TensorFlow. TensorFlow 2 provides full Keras integration, making advanced machine learning easier and more convenient than ever before. This book also introduces neural networks with TensorFlow, runs through the main applications (regression, ConvNets (CNNs), GANs, RNNs, NLP), covers two working example apps, and then dives into TF in production, TF mobile, and using TensorFlow with AutoML.
Table of Contents (19 chapters)
17
Other Books You May Enjoy
18
Index

Activation functions

In Chapter 1, Neural Network Foundations with TensorFlow 2.0, we have seen a few activation functions including sigmoid, tanh, and ReLU. In the following section we compute the derivative of these activation functions.

Derivative of the sigmoid

Remember that the sigmoid is defined as (see Figure 6):

Figure 6: Sigmoid activation function

The derivative can be computed as follows:

Therefore the derivative of can be computesd as a very simple form .

Derivative of tanh

Remember that the arctan function is defined as, as seen in Figure 7:

Figure 7: Tanh activation function

If you remember that and , then the derivative is computed as:

Therefore the derivative of tanh(z) can be computed as a very simple form: .

Derivative of ReLU

The ReLU function is defined as f(x) = max(0, x) (see Figure 8). The derivative of ReLU is:

Note that ReLU is non-differentiable at zero. However, it is differentiable...