DEV Community


Multi-layered perceptron

Updated on ・2 min read

A multi-layered perceptron (MLP) is one of the most common neural network models used in the field of deep learning. Often referred to as a “vanilla” neural network, an MLP is simpler than the complex models of today’s era. However, the techniques it introduced have paved the way for further advanced neural networks.

The multilayer perceptron (MLP) is used for a variety of tasks, such as stock analysis, image identification, spam detection, and election voting predictions.

The Basic Structure

A multi-layered perceptron consists of interconnected neurons transferring information to each other, much like the human brain. Each neuron is assigned a value. The network can be divided into three main layers.

Input Layer
This is the initial layer of the network that takes in an input that will be used to produce an output.

Hidden Layer(s)
The network needs to have at least one hidden layer. The hidden layer(s) perform computations and operations on the input data to produce something meaningful.

Output Layer
The neurons in this layer display a meaningful output.

Alt Text


The MLP is a feedforward neural network, which means that the data is transmitted from the input layer to the output layer in the forward direction.

The connections between the layers are assigned weights. The weight of a connection specifies its importance. This concept is the backbone of an MLP’s learning process.

Alt Text

While the inputs take their values from the surroundings, the values of all the other neurons are calculated through a mathematical function involving the weights and values of the layer before it.

For example, the value of the h5 node could be:

h5 = h1.w8 + h2.w9h5=h1.w8+h2.w9


Backpropagation is a technique used to optimize the weights of an MLP using the outputs as inputs.

In a conventional MLP, random weights are assigned to all the connections. These random weights propagate values through the network to produce the actual output. Naturally, this output would differ from the expected output. The difference between the two values is called the error.

Backpropagation refers to the process of sending this error back through the network, readjusting the weights automatically so that eventually, the error between the actual and expected output is minimized.

In this way, the output of the current iteration becomes the input and affects the next output. This is repeated until the correct output is produced. The weights at the end of the process would be the ones on which the neural network works correctly.

Alt Text
Alt Text
Alt Text
Alt Text
Alt Text
Alt Text

Discussion (0)

Forem Open with the Forem app