The perceptron (1958) is the ancestor of every neural network. For labels , it predicts , and for each misclassified example it updates and .
Implement train_perceptron(X, y, lr=1.0, epochs=100): start from zeros, loop over examples in order each epoch, and treat as a mistake. Stop early after an epoch with no mistakes. Return (w, b, mistakes_per_epoch).
Also implement predict(X, w, b), returning ±1 (0 maps to +1).