Multi-layered perceptron
Tags: ai, machinelearning, neuralnetwork, beginners
Published: 2021-04-23 06:15:24

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pqfml8g9lwhqcwkxvigv.png)

**Connections**

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a0xve1z9fhc538y21xcd.jpg)

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**

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7fh9wwlkmkmkno4spkmo.png)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7rfi0exmpvnbpy51viux.png)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q53hr13r94b59yzkv8fa.png)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c009zrvhp52g7mc2p7gj.png)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qc5c1kcv6d6c36wf87uw.png)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/beahim8qrcm59ehp12nv.png)