A nonlinearity follows a linear operation so a neural network can build complex functions instead of remaining purely linear. These functions are called activation functions. section 2.2.3
Two historical activation functions illustrate the idea:
- Sigmoid, σ(x), maps inputs into [0, 1]. section 2.2.3
- Hyperbolic tangent, tanh(x), maps inputs into [−1, 1]. section 2.2.3
Insert tanh between linear layers
In PyTorch, use nn.Sequential(nn.Linear(1, 10), nn.Tanh(), nn.Linear(10, 1)). With two linear layers, one activation sits between the hidden and output layers. section 2.2.3






