Lesson 11 of 15
The Perceptron
The Perceptron
The perceptron is the simplest neural network unit — a single binary classifier. It computes a weighted sum of its inputs and fires (outputs 1) if the sum exceeds a threshold:
Learning Rule
The perceptron learning rule updates the weights whenever a prediction is wrong:
where is the learning rate.
- If the prediction is correct: error = 0, no update
- If the true label is 1 but we predicted 0: error = +1, weights increase
- If the true label is 0 but we predicted 1: error = −1, weights decrease
Historical Note
Rosenblatt's 1958 perceptron was the first trainable neural model. Minsky & Papert (1969) showed it cannot learn XOR — motivating multi-layer networks.
Your Task
Implement:
perceptron_output(x, w, b)→ 1 if dot(x,w)+b > 0 else 0perceptron_update(w, b, x, y_true, lr)→ (new_w, new_b)
Python runtime loading...
Loading...
Click "Run" to execute your code.