- Asked 2/12
- 2072 Magh · 2+7 marks
Perceptron; neural network as OR gate
Short answer
A perceptron is a single neuron that computes a weighted sum and outputs 1 if it exceeds a threshold. For an OR gate, set weights w1=w2=1 and threshold 0.5; net=x1+x2, output 1 if net >= 0.5.
What do you understand by a perceptron? How can we design a neural network that acts as an OR gate?
A perceptron is the simplest neural network: a single neuron that forms the weighted sum of its inputs, adds a bias (or compares with a threshold θ) and outputs 1 if the sum is large enough, else 0 (step function). It acts as a linear binary classifier and can learn with the rule w ← w + η(t − y)x.
Designing an OR gate
OR is linearly separable, so one perceptron is enough.
x1 --(w1 = 1)-->\
( Σ ≥ θ ?)--> y θ = 0.5 (or b = -0.5)
x2 --(w2 = 1)-->/
Net input = 1·x1 + 1·x2; output y = 1 if net ≥ 0.5, else 0.
| x1 | x2 | net = x1 + x2 | y (net ≥ 0.5) | OR target |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 | 1 |
| 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 2 | 1 | 1 |
All four rows match the OR truth table.
Check using inequalities
We need 0 < θ (for 0,0), w1 ≥ θ, w2 ≥ θ and w1 + w2 ≥ θ. Choosing w1 = w2 = 1, θ = 0.5 satisfies all of them.
Decision boundary
x1 + x2 = 0.5 is a line that separates (0,0) from the other three points.
Training alternative
Start with w1 = w2 = 0, b = 0, η = 1, use the output y = 1 if net > 0 (else 0), and apply the perceptron rule to the four patterns. It converges within three epochs to w = (1, 1), b = 0, which also implements OR (any weights that separate the classes will do).
Answer: w1 = 1, w2 = 1, threshold 0.5.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Perceptron; neural network as XOR gate · Artificial Intelligence, chapter 6 · asked 2×
- Role of perceptron in neural network · Artificial Intelligence, chapter 6 · asked 2×
- Neural network, back-propagation, perceptron · Artificial Intelligence, chapter 6
- Short note: Neural network, perceptron rule · Data Mining, chapter 3