Feed-Forward Neural Networks (MLPs) and Training Optimization
Foundations of Artificial Neural Networks and the Perceptron
An Artificial Neural Network (ANN) is an information processing paradigm inspired by biological nervous systems. The basic fundamental building block of an ANN is the Perceptron (or artificial neuron).
Mathematical Formulation of a Perceptron
A perceptron receives a vector of input features, scales them by corresponding synaptic weights, introduces an additive bias term, and routes the accumulated linear combination through an activation function (non-linearity) to generate an output.
Inputs: A set of m numerical features, denoted as x1,x2,…,xm, represented as an input column vector:
X=x1x2⋮xm
Weights: Synaptic strengths corresponding to each input channel, denoted as w1,w2,…,wm, organized as a row vector:
W=[w1w2…wm]
Bias: An offset parameter b, which can be conceptualized as a weight connected to a constant fixed input of 1.
Linear Combination (Summation): The pre-activation scalar z is computed as the inner product of weights and inputs plus the bias:
z=b+∑i=1mxiwi=WX+b
Non-Linearity (Activation Function): A function g(⋅) applied to the linear combination z.
Output: The predicted output y^ is defined as:
y^=g(z)=g(b+∑i=1mxiwi)=g(WX+b)
Geometrically, the equation WX+b=0 establishes a hyperplane known as the decision boundary, which partitions the input feature space into two distinct regions.
Linear Separability and Logic Gate Implementation
A single perceptron functions as a linear classifier capable of learning linearly separable logical operators such as AND and OR.
The AND Logic Gate Implementation
An AND gate outputs 1 if and only if both binary inputs are 1, and outputs 0 otherwise.
Weight Vector:
W=[11]
Bias:
b=−1.5
Pre-activation Equation:
z=WX+b=x1+x2−1.5
Activation Function: The Heaviside step function:
g(z)={10if z≥0if z<0
Truth Table and Verification
x1
x2
z=x1+x2−1.5
Predicted Output y^=g(z)
Target Output
0
0
−1.5
0
0
0
1
−0.5
0
0
1
0
−0.5
0
0
1
1
0.5
1
1
The decision boundary is given by x1+x2−1.5=0, cleanly separating the point (1,1) from the set of points {(0,0),(0,1),(1,0)}.
Limitations of a Single Perceptron: The XOR Problem
The Exclusive-OR (XOR) logic gate outputs 1 when inputs differ and 0 when they are identical:
(0,0)→0
(0,1)→1
(1,0)→1
(1,1)→0
A single linear decision boundary cannot isolate the diagonal points (0,1) and (1,0) from (0,0) and (1,1). The XOR problem is not linearly separable and requires drawing two lines instead of one.
Multi-Layer Perceptrons and the XOR Architecture
To separate non-linearly separable functions, multiple perceptrons are connected hierarchically. A Two-Layer Perceptron consists of one hidden layer and one output layer.
By introducing a hidden layer, the network maps the original non-linearly separable input vectors x into an intermediate transformed representation y. The output layer then applies a final linear decision boundary on this transformed space.
Mathematical Formulation of the XOR Two-Layer Network
For the first sample x(1)=[1000400], with actual target y(1)=450, an unoptimized network with randomly initialized weights outputs y^(1)=50. This substantial error demonstrates the need for weight optimization.
Cross-Entropy Loss for Classification
In classification tasks, exact continuous values are not required; the network outputs probabilities in the range [0,1], which are thresholded or rounded to binary labels {0,1}.
where W={W(0),W(1),…} represents the collection of all weight matrices and bias vectors across the entire network architecture.
The Loss Landscape and the Gradient
The cost function J(W) defines a high-dimensional loss surface over the parameter space (e.g., J(w0,w1)). This landscape exhibits complex topography, including local minima, global minima, plateaus, and saddle points.
Definition of Gradient: The gradient of a scalar-valued function f of several variables is the vector ∇f whose value at any given point gives the direction and the rate of fastest increase.
To minimize the objective function, the weights must be adjusted in the direction opposite to the gradient.
Gradient Descent Algorithm
The optimization procedure executes iteratively according to the following algorithmic routine:
Weight Initialization: Initialize all network weights randomly from a normal distribution:
W∼N(0,σ2)
Optimization Loop: Repeat until convergence criteria are met:
Gradient Computation: Compute the partial derivatives of the cost function with respect to every parameter:
∂W∂J(W)
Weight Update: Take a step in the direction opposite to the gradient, scaled by the learning rate η:
W←W−η∂W∂J(W)
Return Parameters: Return the optimized parameter configuration W∗.