Neural Foundations: Perceptrons & Activation Math
Understand the mathematical mechanics of biological vs artificial neurons, linear hyperplanes, and non-linear activation functions.
1. The Artificial Neuron (Frank Rosenblatt's Perceptron)
At its fundamental level, an artificial neuron computes the weighted sum of its inputs, adds a scalar bias term, and maps the output through an activation function \(\sigma(z)\):
\[ z = \mathbf{w}^T \mathbf{x} + b = \sum_{i=1}^{n} w_i x_i + b \]
The scalar bias \(b\) shifts the decision boundary hyperplane away from the origin, allowing the model to fit non-zero-centered classification boundaries.
2. Non-Linear Activation Functions
Without non-linear activations, stacking multiple dense layers results in a single linear transformation: \(W_2(W_1 x + b_1) + b_2 = (W_2 W_1) x + (W_2 b_1 + b_2)\), rendering deep architectures no more powerful than linear regression.
- ReLU (Rectified Linear Unit): \(f(x) = \max(0, x)\). Fast compute and zero gradient saturation for positive values, but susceptible to the "Dying ReLU" problem when gradients become zero for \(x < 0\).
- GELU (Gaussian Error Linear Unit): Used in modern Transformers (BERT, GPT-4):
\[ \text{GELU}(x) = x \cdot \Phi(x) = x \cdot P(X \le x), \quad X \sim \mathcal{N}(0,1) \]
- Sigmoid & Tanh: Essential for probability bounding \(\sigma(z) = \frac{1}{1 + e^{-z}}\) and zero-centered outputs \([-1, 1]\).