### What is a Perceptron?

The Perceptron is an algorithm for supervised learning of binary classifiers. A binary classifier is a function which can decide whether or not an input, represented by a vector of numbers, belongs to some specific class.

Biological Neuron
The Perceptron is a simplified model of a biological neuron. Most neurons receive signals via the dendrites and send out signals down the axon. At the majority of synapses, signals cross from the axon of one neuron to a dendrite of another. The following figure demonstrate how a biological neuron in terms of input and output is modeled.

Neuron - Math Model
As mentioned before, the Perceptron is an algorithm for learning a binary classifier called a threshold function: a function that maps its input $\mathbf {x}$ (a real-valued vector) to an output value $f(\mathbf {x} )$ (a single binary value):

$f(\mathbf {x} )={\begin{cases}1&{\text{if }}\ \mathbf {w} \cdot \mathbf {x} +b>0,\\0&{\text{otherwise}}\end{cases}}$ Perceptron Learning Algorithm
Perceptron learning algorithm can be written as the following steps:
1. Initialize the weights and the threshold.
2. For each example
a. Calculate the actual output b. Update the weights as followoing 3. The second step may be repeated until the iteration error is less than a user-specified error threshold  or a predetermined number of iterations have been completed, where error is defined as followin. Multiclass Perceptron (MCP)
So far, we have used the Perceptron as a binary classifier, telling us the probability p that a point x belongs to one of two classes. The probability of x  belonging to the respective other class is then given by 1−p. Generally, however, we could have more than two classes which means more than one neuron should be used in the output. Also, Perceptron can have more than one layer which is called multi-layered Perceptron.

Multi Layer Perceptron usually uses BackPropagation Algorithm for learning.

Show me some Code

References