Training a perceptron
The perceptron is arguably the building block of deep learning. Even if the perceptron is not directly used in production systems, understanding what it is can be an asset for building a strong foundation in deep learning.
In this recipe, we will review what a perceptron is and then train one using scikit-learn on the Iris dataset.
Getting started
The perceptron is a machine learning method first proposed to mimic a biological neuron. It was first proposed in the 1940s and then implemented in the 1950s.
From a high-level point of view, a neuron can be described as a cell that receives input signals and fires a signal itself when the sum of the input signals is above a given threshold. This is exactly what a perceptron does; all you have to do is the following:
- Replace the input signals with features
- Apply a weighted sum to those features and apply an activation function to it
- Replace the output signal with a prediction
More formally...