A perceptron is a linear binary classifier. For a feature vector x, weights θ, and offset θ₀, it predicts h(x) = sign(θ·x + θ₀), assigning a label of +1 or −1. The equation θ·x + θ₀ = 0 defines its decision boundary: a hyperplane whose normal vector is θ. section 5.2
Training is mistake-driven. Compare each prediction with its ground-truth label y; a negative product y·h(x) indicates disagreement. The implementation initializes θ and θ₀ to zero, repeatedly samples training examples, and updates when y(θ·x + θ₀) ≤ 0. These updates move the decision boundary toward fewer classification mistakes. section 5.2 section 5.8
Iris binary classification
Fit the classifier to iris features, then compare predicted and actual labels in a confusion matrix. True positives and true negatives are correct predictions; false positives and false negatives are mistakes. The same counts support measures such as true positive rate and false positive rate. section 5.2
Figure 5.2 Linear classifier a decision boundary
The two-dimensional diagram shows how a linear decision boundary separates the +1 and −1 sides. section 5.2




