Perceptron
What are Perceptrons?
In essence, a perceptron is an artificial neuron and represents the simplest form of an artificial neural network. An artificial neuron is a mathematical function, taking in inputs and producing an output – based on the idea of the biological neurons. The perceptron is a supervised machine learning algorithm (part of the binary classifiers), taking a number of binary inputs and producing one binary output – binary outputs can always be only two outcomes, for instance either 1 or 0, True or False, Yes or No, and so on.
A perceptron consist of inputs, function, and an output. The following is a simple diagram of a perceptron.

Calculation of a Perceptron
There are five steps to calculating a perceptron:
- Setting up a threshold value
The threshold is used for the final decision – if the outcome is under the threshold the perceptron returns 0, otherwise 1. - Applying weights to the values
The assignment of weights provides a numerical importance to the values – which input value have greater impact on the output. - Multiplying all weights with the values
This results to weighted values for all inputs. - Adding all results
The outcome of this step provides the weighted sum of all inputs and the outcome for the threshold comparison. - Activating the function
The basic function of a perceptron compares the result and the threshold value in order to produce a final outcome.
The following is a more complex diagram of a perceptron, including the calculation steps.

Example
The following is a simple example of a perceptron calculation.
Objective: recommend whether someone should dine in a particular restaurant.
The dataset contains six inputs:
- Location – location of the restaurant (good or bad)
- Reviews – reviews from a local rating website (positive or negative)
- Service – service of the restaurant (good or bad)
- Price – pricing of the food and drinks (affordable or expensive)
- Entertainment – (yes or no)
- Food – favourite type of food (cuisine) of the person dining (yes or no)
The table below display the values for the specific restaurant of this example.
Location | 1 (good) |
Reviews | 1 (positive) |
Service | 0 (bad) |
Price | 1 (affordable) |
Entertainment | 0 (no) |
Food | 0 (no) |
The five steps of calculating a perceptron algorithm.
- The threshold value is 2.0. Anything below 2.0 returns NO (not recommending the restaurant), and a result above 2.0 returns YES (recommending the restaurant).
______________________________ - Value weights represent how strongly would the specific value affect the final decision. The input weights are as follows:
0.7 location
0.5 reviews
0.4 service
0.7 price
0.3 entertainment
0.2 food
______________________________ - Multiplication of weights and values:
0.7 x 1 = 0.7
0.5 x 1 = 0.5
0.4 x 0 = 0
0.7 x 1 = 0.7
0.3 x 0 = 0
0.2 x 0 = 0
______________________________ - Summing results:
0.7 + 0.5 + 0 + 0.7 + 0 + 0 = 1.9 (weighted sum)
______________________________ - The activation functions compares the weighted sum with the threshold:
Weighted sum – 1.9
Threshold – 2.0
1.9 < 2.0
The weighted sum is smaller than the threshold, therefore the perceptron’s outcome is NO – not recommending the restaurant.
Next: Intelligent Agents