Tanh

Also known as: Hyperbolic Tangent

Category: Neural Networks & Architectures

An activation function that squashes inputs to the range (-1, 1), providing zero-centered outputs.

Full Explanation

The hyperbolic tangent (tanh) function maps inputs to the range (-1, 1) and is defined as tanh(x) = (e^x - e^(-x))/(e^x + e^(-x)). It is essentially a scaled and shifted sigmoid function. Tanh offers zero-centered outputs, which can lead to faster convergence compared to sigmoid since gradients are not biased in one direction. Like sigmoid, tanh suffers from the vanishing gradient problem for extreme input values, but less severely. Tanh is commonly used in recurrent neural networks, particularly in LSTM gating mechanisms, and for normalizing hidden states. While ReLU has replaced tanh in most feedforward architectures, tanh remains valuable in specific contexts where bounded, zero-centered outputs are desirable.

Related Terms

More in Neural Networks & Architectures

Explore More