Computational Agents
Lesson 7 of 12
58%
Free Section Starter (Lesson 7)
PYTHON Free Section Starter Challenge 25 min

7. The Perceptron Algorithm & Decision Boundaries

Overview: Train a single-layer artificial neuron using iterative weight delta updates.

Concept & Syntax Guide

A perceptron calculates a weighted sum of inputs $\sum w_i x_i + b$ and passes it through a step activation threshold. If a sample is misclassified, weights are adjusted via $w_i \leftarrow w_i + \eta (y - \hat{y}) x_i$. For linearly separable data, the perceptron learning rule is guaranteed to converge.

Hands-On Practice Exercise

Train Perceptron to Convergence

Simulate perceptron weight updates over 4 epochs to reach target weights [0.2, 0.4].

Target Output: Perceptron converged in 4 epochs: Weights [0.2, 0.4]
Need a hint? Click here to reveal
Hint: Check syntax carefully and make sure your code contains: Perceptron converged in 4 epochs: Weights [0.2, 0.4]
PYTHON Code Editor
1
2
3
4
5
6
7
8
9
10