Artificial Intelligence · Artificial Neural Networks
Perceptron and Multilayer Networks
Overview
The perceptron is the fundamental building block of artificial neural networks: a single neuron that computes a weighted sum of inputs and applies a threshold.
Multilayer networks extend this by stacking layers of neurons with non-linear activation functions, enabling learning of complex non-linear decision boundaries.
This topic sits under Artificial Neural Networks in the UGC NET Computer Science syllabus. It requires basic understanding of vectors, weighted sums, step and sigmoid functions, and derivatives.
Mastery of these concepts is essential for questions on network architecture, learning rules, activation functions, and backpropagation.
Key concepts
- Perceptron: A single neuron model with adjustable weights and bias. It takes input vector , computes (or ), and outputs .
- Bias () / Threshold (): Bias shifts the decision boundary. Often , so output if else . In some conventions , so , output if .
- Activation function: Non-linear function applied to net input. Step function (Heaviside): if else . Sign function: if else . Sigmoid (logistic): , range . Tanh: range .
ReLU: . - Decision boundary: The set of points where . For a single perceptron, it is a linear hyperplane.
- Linear separability: Two classes are linearly separable if there exists a hyperplane that separates them. A single-layer perceptron can solve only linearly separable problems. AND, OR are linearly separable; XOR is not.
- Perceptron learning rule: For each training example , compute . If , update and . is the learning rate.
The algorithm stops after finite steps if the data is linearly separable (Perceptron Convergence Theorem). - Multilayer Perceptron (MLP): A feedforward network with an input layer, one or more hidden layers, and an output layer. Each layer has neurons with non-linear activations.
MLPs can approximate any continuous function (Universal Approximation Theorem). - Backpropagation: Supervised learning algorithm for MLPs.
It performs a forward pass to compute outputs, calculates the error, then propagates the error backward from output to input, computing gradients using the chain rule, and updates weights via gradient descent. - Delta rule: Also called Widrow–Hoff or LMS rule. For a linear neuron with squared error, . It is the basis for backpropagation.
- Gradient descent: , where is learning rate, is error. The negative sign moves weights opposite to the gradient to minimize error.
- Epoch: One full pass through the training set.
- Learning rate ( or ): Step size for weight updates. Too large may cause oscillation; too small slows convergence.
How it works
Perceptron computation and learning:
- Initialize weights and bias (often to small random values or zeros).
- For each training example : a. Compute net input: . b. Apply activation: . For binary classification, use step or sign. c. Compute error: . d. If , update weights: , and bias .
- Repeat for all examples (one epoch). If the dataset is linearly separable, the algorithm converges to a separating hyperplane in finite steps. If not, it may oscillate.
The update rule moves the decision boundary in the direction that reduces misclassification: if output is 0 but target is 1, weights increase for positive inputs and decrease for negative inputs, shifting the boundary to include the point.
Multilayer network and backpropagation:
- Architecture: Input layer (features), hidden layers (non-linear feature extraction), output layer (prediction). Each neuron in layer receives inputs from previous layer, computes , applies activation .
- Forward pass: Feed input through the network layer by layer to compute final output.
- Compute error: For squared error, over output neurons .
- Backward pass: Compute delta for each neuron.
- Output layer: .
- Hidden layer: (where ranges over neurons in the next layer).
- Update weights: , and bias . (This corresponds to gradient descent: , since .)
- Repeat for many epochs until error is minimized.
The chain rule is the core: the gradient of error with respect to a weight in an early layer depends on the deltas of all subsequent layers.
Decision boundary derivation: For a perceptron with , the boundary is . Points with belong to one class, to the other.
To check if a line separates classes, plug each point into the line expression; all points of one class must give the same sign, and the other class the opposite sign.
Why XOR fails: XOR points , , , . No single straight line can separate the 1s from the 0s. A single perceptron can only draw one straight line. Adding a hidden layer allows the network to combine multiple linear boundaries into a non-linear one.
Drawing the diagram…
Formulas
- Net input: (or ).
- Step activation: (or threshold ).
- Sign activation: .
- Sigmoid (logistic): , derivative .
- Scaled sigmoid: , derivative . For , .
- Perceptron weight update: ; bias .
- Delta rule (LMS): .
- Gradient descent: .
- Squared error: .
- Backprop output delta: .
- Backprop hidden delta: .
- Backprop weight update: .
- Decision boundary: .
Worked examples
Example 1 (Perceptron output): A perceptron has weights , and threshold . Inputs are , . The output is 1 if , else 0. Compute:
.
Since , output = 0. Answer: 0.
Example 2 (Weight update): A perceptron uses update rule . Given , , , , . Compute error . Update: .
Example 3 (Decision boundary): Class : . Class : . Which line separates? Test .
For : ; ; .
For : . All on negative side, on positive side. So is the boundary.
Example 4 (Sigmoid derivative): Given , find . Rewrite as . Derivative: . At : , so . Alternatively use ; , so .
Example 5 (Backprop weight update): Consider a network with one input , one hidden neuron with weight and bias , activation sigmoid . Output layer has one neuron with weight and bias , also sigmoid.
Target . Learning rate . Compute one weight update for and .
Forward: hidden net . Hidden output . Output net . Output .
Error at output: . Output delta: .
Update : .
Hidden delta: .
Update : .
Comparison
| Feature | Single-Layer Perceptron | Multilayer Perceptron (MLP) |
|---|---|---|
| Layers | Input and output only | Input, one or more hidden, output |
| Activation | Typically step or sign (linear threshold) | Non-linear (sigmoid, tanh, ReLU) |
| Decision boundary | Linear hyperplane | Non-linear, complex |
| XOR problem | Cannot solve | Can solve |
| Learning algorithm | Perceptron rule | Backpropagation (gradient descent) |
| Convergence | Guaranteed if linearly separable | No guarantee; may get stuck in local minima |
| Activation | Formula | Range | Derivative | Typical Use |
|---|---|---|---|---|
| Step | if else | 0 except undefined at 0 | Binary classification | |
| Sign | if else | 0 except undefined at 0 | Binary classification | |
| Sigmoid | Output probabilities, hidden layers | |||
| Tanh | Hidden layers | |||
| ReLU | 1 if , 0 if | Deep networks |
| Concept | Perceptron Rule | Delta Rule |
|---|---|---|
| Error signal | where is threshold output | where is linear output |
| Update | ||
| Target | Binary labels | Continuous or binary |
| Basis | Error correction | Gradient descent on squared error |
Revision summary
- Single perceptron = linear classifier. Decision boundary is .
- Perceptron update: . Bias updates with .
- XOR is not linearly separable; AND, OR are.
- Backpropagation direction: error propagates backward from output to input.
- Sigmoid: , derivative . Scaled sigmoid has derivative .
- Gradient descent update: .
- Delta rule = Widrow–Hoff = LMS: adjusts weights by .
- Perceptron convergence theorem: if linearly separable, converges in finite steps.
- Hidden layers enable non-linear decision boundaries.
- Learning rate controls step size; too large causes oscillation, too small slows convergence.
- Sign activation outputs ; step outputs .
- Check bias sign carefully: vs .
Previous-year exam insights
- Direct numeric computation: Given weights, threshold, inputs, compute perceptron output.
Carefully apply the inequality (≥ vs >) and sign of bias/threshold. - Learning rule identification: Know the exact perceptron update rule with input vector and error .
Options often omit or use wrong sign. - Decision boundary testing: Given points and a candidate line, plug points into the line equation; all points of one class must have the same sign, and the other class the opposite sign.
Traps: sign convention, arithmetic errors. - Activation function formulas and derivatives: Sigmoid formula and its derivative.
For scaled sigmoid , derivative at 0 is 1/2.
Do not confuse with unscaled derivative (1/4). - Backpropagation direction: Weight changes propagate backward from sink (output) to source (input).
Understand forward pass computes outputs, backward pass computes gradients. - Linear separability: Identify which Boolean functions (AND, OR, XOR) a single-layer perceptron can solve.
XOR requires hidden layer or RBF. - Gradient descent sign: Weight update is (minus sign) to minimize error.
- Match-the-list: Match perceptron, hidden layer, backpropagation, linear separability with their definitions/properties.
Read each term carefully.
Practice at PARIKSHA
You are ready for the PARIKSHA tests of this sub-topic when you can:
- Compute the output of a single perceptron given weights, bias/threshold, and inputs, using both step and sign activations.
- Apply the perceptron learning rule to update weights for a misclassified example.
- Determine whether a given set of 2D points is linearly separable and find a separating line.
- Explain why XOR cannot be solved by a single-layer perceptron but can be solved by a multilayer network.
- Write the formula and derivative of the sigmoid function, including scaled versions.
- Describe the forward pass and backward pass in backpropagation and write the delta formulas for output and hidden layers.
- Distinguish between the perceptron rule and the delta rule.
- State the perceptron convergence theorem and its condition.
- Identify the role of hidden layers and non-linear activation functions in MLPs.
- Match terms like perceptron, linear separability, backpropagation, and gradient descent with their correct descriptions.
Attempt the sub-topic test first, then the subject test.