Multilayer Perceptron
A Multilayer Perceptron (MLP) extends the single perceptron by stacking multiple layers of neurons together, allowing the network to learn complex, non-linear patterns that a single perceptron cannot.
Structure of an MLP
- Input Layer - receives the raw features
- Hidden Layer(s) - one or more layers that learn intermediate representations
- Output Layer - produces the final prediction
Why Hidden Layers Matter
Each hidden layer applies a non-linear activation function to its inputs, allowing the network to model curved decision boundaries instead of just straight lines. Stacking enough layers with enough neurons lets an MLP approximate almost any function - this is known as the Universal Approximation Theorem.
Implementing an MLP in Python
from sklearn.neural_network import MLPClassifier
model = MLPClassifier(hidden_layer_sizes=(16, 8), activation="relu", max_iter=500)
model.fit(X_train, y_train)
print(model.predict(X_test))
MLPs are also called "fully connected" or "dense" networks, since every neuron in one layer connects to every neuron in the next - this is the same core structure used at the heart of most deep learning architectures.
Coming Up Next
With the building blocks in place, let's zoom out and look at the full picture of how Artificial Neural Networks are structured.