liveBook · Manning

ReLU

As explained in Grokking Machine Learning

An activation function that returns zero for negative inputs and the input itself for nonnegative inputs.

ReLU, or rectified linear unit, leaves nonnegative inputs unchanged and turns negative inputs into zero: ReLU(x) = x for x ≥ 0, and ReLU(x) = 0 for x < 0. Used between neural-network layers, it helps break linearity and build more complex decision boundaries. section 10.2 section 10.6

For positive inputs, ReLU’s derivative is 1, which helps reduce the vanishing-gradient problem. It is widely used in neural networks, in contrast to sigmoid and tanh, whose flat derivatives can contribute to that problem. section 10.2 section 10.6

ReLU in a Keras network

A classifier for a circular dataset uses ReLU in hidden layers of 128 and 64 units, followed by a two-unit softmax output. A handwritten-digit classifier uses the same hidden-layer sizes and ReLU activations. section 10.3

Figure 10.19 Three different activation functions used in neural networks. Left: The sigmoid function, represented by the Greek letter sigma. Middle: The hyperbolic tangent, or tanh. Right: The rectified linear unit, or ReLU.

Compare the plotted shapes of sigmoid, tanh, and ReLU. section 10.2

How Grokking Machine Learning covers it

How deep it goes
Defines ReLU with a piecewise rule and explains its positive-input derivative and connection to vanishing gradients.
Examples
Shows ReLU in Keras classifiers for a circular dataset and handwritten digits.
What you can do after
Apply it via Keras by assigning ReLU activations to hidden layers in a classifier.
How it connects
Connects ReLU to neural networks, perceptrons, activation functions, sigmoid, tanh, and vanishing gradients.

Also explained in

Compare how 12 books explain ReLU →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning. The section links point to the parts of the book it draws on.