In statistical learning and neural networks, mathematical transformation functions govern how linear combinations of inputs map to predictions, probabilities, and nonlinear feature representations.
Activation Functions vs. Link Functions
In Generalized Linear Models (GLMs), an input feature vector x=[x1,…,xD]T is combined with weight vector w and bias w0 into a linear predictor:
η=wTx+w0
The mathematical relationship between the linear predictor η and the conditional expectation of the target variable μ=E[Y∣x] is defined through two inverse concepts:
- Link Function g(μ): Maps the expected value μ into the unbounded linear predictor space:
g(μ)=wTx+w0
- Activation Function f(η): The inverse of the link function, f=g−1, mapping the unbounded linear combination back to the target scale:
μ=f(η)=f(wTx+w0)
| Model |
Target Distribution |
Link Function g(μ) |
Activation Function f(η) |
| Linear Regression |
Gaussian N(μ,σ2) |
Identity: g(μ)=μ |
Identity: f(η)=η |
| Logistic Regression |
Bernoulli Bern(p) |
Logit: g(μ)=ln(1−μμ) |
Logistic Sigmoid: f(η)=1+e−η1 |
| Poisson Regression |
Poisson Pois(λ) |
Log link: g(μ)=ln(μ) |
Exponential: f(η)=eη |
Linear Decision Surfaces
Even when the activation function f(⋅) is nonlinear (such as sigmoid or step functions), the resulting decision boundary remains a linear hyperplane in feature space:
wTx+w0=constant
Because f is strictly monotonic, thresholding the probability P(Y=1∣x)≥0.5 is equivalent to thresholding the linear argument wTx+w0≥0.
Logistic Sigmoid
The logistic sigmoid function maps the real line R→(0,1), interpreting outputs as probabilities:
σ(z)=1+e−z1=1+ezez
Mathematical Properties
- Symmetry:
σ(−z)=1−σ(z)
- Derivative:
dzdσ(z)=σ(z)(1−σ(z))
The maximum derivative occurs at z=0, where σ′(0)=0.25.
- Inverse (Logit):
σ−1(p)=logit(p)=ln(1−pp)
- Vanishing Gradient: For ∣z∣≫0, σ′(z)→0, causing backpropagated gradients to diminish across deep layers.
Hyperbolic Tangent (tanh)
The hyperbolic tangent function maps R→(−1,1):
tanh(z)=ez+e−zez−e−z=cosh(z)sinh(z)
Relation to Sigmoid & Advantages
tanh(z)=2σ(2z)−1
- Zero-Centered Output: Outputs have mean close to zero. Unlike sigmoid (whose outputs are strictly positive in (0,1)), zero-centered activations prevent gradient vectors from always pointing in the same direction during backpropagation, improving convergence speed.
- Derivative:
dzdtanh(z)=1−tanh2(z)
Maximum derivative is 1.0 at z=0 (4x steeper than sigmoid).
Softmax Function
Softmax generalizes the binary logistic function to multi-class classification across K≥2 mutually exclusive classes:
Softmax(z)i=∑j=1Kezjezifor i=1,…,K
Properties & Numerical Stability
- Probability Distribution:
i=1∑KSoftmax(z)i=1andSoftmax(z)i∈(0,1)
- Shift Invariance: For any scalar constant c∈R:
∑jezj−cezi−c=e−c∑jezje−cezi=Softmax(z)i
In production implementations, setting c=maxj(zj) prevents numerical overflow (
NaN from large exponentials).
- Derivative:
∂zj∂Softmax(z)i=Softmax(z)i(δij−Softmax(z)j)
where δij is the Kronecker delta (1 if i=j, else 0).
Rectified Linear Unit (ReLU) & Smooth Approximations
ReLU
ReLU(x)=max(0,x)
- Computational Efficiency: Evaluated via a single conditional comparison; derivative is either 0 (for x<0) or 1 (for x>0).
- No Saturation for x>0: Gradient does not vanish for positive inputs, enabling training of very deep architectures.
- Dying ReLU: Neurons whose pre-activation stays negative across all training examples have zero gradient and permanently deactivate.
Softplus (Smooth ReLU)
Softplus(x)=ln(1+ex)
The first derivative of Softplus is analytically identical to the logistic sigmoid:
dxdSoftplus(x)=1+exex=σ(x)
Leaky ReLU & Parametric ReLU (PReLU)
f(x)=max(αx,x)={xαxif x≥0if x<0
Setting small slope α>0 (typically α=0.01) ensures non-zero gradient everywhere, eliminating the dead neuron issue.