Tanh / Hyperbolic Tangent Activation Function
🔵 Tanh / Hyperbolic Tangent Activation Function The tanh (hyperbolic tangent) function is another important nonlinear activation function used in artificial neural networks. It is closely related to the sigmoid function, but it has one important advantage: its output is centered around zero . The tanh function is particularly useful for understanding the evolution from sigmoid-based neural networks to modern activation functions such as ReLU. 🧠 1. What Is the Tanh Function? The hyperbolic tangent function is defined as: tanh ( z ) = e z − e − z e z + e − z \boxed{ \tanh(z)=\frac{e^z-e^{-z}}{e^z+e^{-z}} } It can also be expressed in terms of the sigmoid function: tanh ( z ) = 2 σ ( 2 z ) − 1 \boxed{ \tanh(z)=2\sigma(2z)-1 } where: σ ( z ) = 1 1 + e − z \boxed{ \sigma(z)=\frac{1}{1+e^{-z}} } The output of tanh lies between: − 1 < tanh ( z ) < 1 So, conceptually: Tanh = scaled sigmoid − shift 📈 2. Shape of the Tanh Function The tanh function has an ...