Writing

Demystifying Deep Learning

3 August 2017Updated 14 October 20267 min read

A plain explanation of deep learning: the problem it solves, the biological neuron that inspired artificial neural networks, how those networks are built and why they took off. It ends with application areas and the main software packages.

Learning is a hard task. How we humans learn deep representations of the world remains one of the great mysteries of science. Tasks that seem trivial or natural to us rest on a complex web of fine-grained processes.

The human mind shows this in many ways. We recognize faces almost instantly. We learn and understand deep structures in language and form symbols to communicate. We compose and perform music, write poetry and create visual art. All of these are evidence of humanity's natural intelligence.

What is Deep Learning?

Deep learning is a way of approaching the learning problem in which the computer learns the underlying representations of the data. These representations are layered, or hierarchical, and come from the problem domain or from the environment the computer interacts with. Deep learning is a form of representation learning for this reason.

This definition is a mouthful. The rest of this post breaks it down.

The Problem of Representation

One of the greatest challenges in AI research is to get the computer to break a problem down into its structure the way a human would.

Some problems are easy to represent as recipes. In computer science, a recipe is a set of instructions for the computer to follow. We can program a computer explicitly to perform a fixed sequence of logical steps that solve a problem or a set of problems.

For example, we can program a computer to guide a satellite into space. It is far harder to program a computer to show empathy, to write a poem or even to understand speech. Interpreting a sentence also takes more than translating it, because interpretation requires a deep understanding of the structure of language. Translation is hard enough, and understanding is harder still.

When we talk about the representation of problems, we mean problems for which it is very hard to write a recipe. We cannot describe them as a set of logical instructions for the computer to execute. Deep learning sets out to solve these problems by learning the representation from examples.

An Inspiration from the Brain

Scientists often look to nature for inspiration. Birds, for example, inspired the airplane. In the same way, the human brain is the natural model for intelligence.

Let's talk briefly about the human brain. We will not venture too far. For one, that is beyond the writer's ability. For another, scholars have devoted centuries to this subject and have only scratched the surface.

We will cover what we know about the brain and how it inspired the algorithm that deep learning rests on, which is called a neural network.

We can view the brain as a society of agents that are networked together and pass information to each other as electrical and chemical signals. These agents are called neurons. Our main interest here is to see what neurons are, what their parts are and how they pass information around.

A neuron is a cell in the brain and a central part of the nervous system. Neurons receive and transmit information to other cells in the body in response to external or internal stimuli. They respond by firing electrical impulses that carry signals to the brain and to other cells. The coordinated work of neurons is central to human intelligence.

Three parts of a neuron are of main interest to us:

  • The axon
  • The dendrites
  • The synapse
Labeled illustration of a neuron showing the dendrites, the cell body with its nucleus, the axon wrapped in a myelin sheath with nodes of Ranvier, and the branching axon terminals
The parts of a neuron.

The axon is a long fiber that extends from the cell body of the neuron, as the figure shows. It carries electrical signals away from the cell body to other neurons through the axon terminals. The dendrites are branches that receive signals from other neurons and carry them to the cell body. A synapse is the junction where a signal passes from one neuron to the next.

These three parts are the biological inspiration for the design and structure of an artificial neural network. Researchers hoped that by imitating the brain, they could build a machine that learns the complex hierarchical features of a problem and builds a model from those features.

Deep Learning Foundations: Artificial Neural Networks (ANN)

An artificial neural network (ANN) builds on the idea of the biological neuron. It is a network of connected artificial neurons that pass information from one to the next. As data moves through the layers of the network, the network learns a hierarchy of representations, or features. This is where the names deep representation learning and deep learning come from.

An artificial neural network has three kinds of layers:

  • An input layer
  • One or more hidden layers
  • An output layer
Diagram of a neural network with two input nodes, two hidden layers of four nodes each and one output node, with arrows connecting every node in one layer to every node in the next
A neural network with an input layer, two hidden layers and an output layer.

The input layer receives the features of each example in the dataset and passes them to the hidden layers.

The hidden layers are where deep learning does most of its work. Each hidden layer can have many neurons, as the image below shows. Each layer learns a more sophisticated set of features than the layer before it. The number of neurons in a layer is the width of the network, and the number of hidden layers is its depth. Choosing them is a technical detail beyond the scope of this post. In simple terms, deep learning differs from earlier neural networks mainly because it uses many hidden layers.

Diagram of a fully connected neural network with an input layer, four hidden layers and an output layer, with every node connected to every node in the next layer
A neural network with four hidden layers.

Finally, the output layer combines the learned representations to produce the output the learning problem needs.

The main families of neural network architectures in deep learning today are:

  • Dense feed-forward networks
  • Convolutional neural networks (CNN), which are widely used for images
  • Recurrent neural networks (RNN), which process sequences
  • Transformers, which power today's large language models and many other foundation models

The Tipping Point: Computational Power and Big Data

The success of deep learning rests mainly on the growth of computing power and data. Graphics processing units (GPUs) and specialized chips such as Google's Tensor Processing Units (TPUs) train models at speeds that were out of reach a few years ago. Meanwhile, wearable devices, the internet of things, social media and the web create large amounts of data every day.

As we saw in a previous post on Machine Learning on the Cloud, there is no learning without data. Large datasets have made deep learning powerful. Training a deep network from scratch generally needs a lot of data. When data is scarce, practitioners often start from a model pre-trained on a large dataset and fine-tune it on their own examples.

Notable Application Areas

Deep learning is used in many areas, including:

  • Object detection
  • Image classification
  • Speech recognition
  • Document segmentation
  • Language translation
  • Text generation and chat assistants built on large language models
  • Game playing, such as Atari games and Go
  • Protein structure prediction
  • Self-driving cars
  • Social network analysis
  • Recommendation systems

Software Packages

The following packages let you start using deep learning without working through the underlying mathematics:

Package Language
PyTorch Python
TensorFlow Python
JAX Python
Eclipse Deeplearning4j Java and other JVM languages
TensorFlow.js JavaScript
torch for R R

Two higher-level libraries make deep learning even easier:

  • Keras is my personal favorite. Keras 3 runs on JAX, TensorFlow or PyTorch.
  • Hugging Face Transformers gives you pre-trained models for text, images and audio that you can use or fine-tune.

Congratulations! We now understand the ideas and foundations of deep learning and can hold an informed discussion about it with a colleague or a friend.

An Interesting Joke

I leave you with a joke that has been circulating on social media. It paints a stark picture of how deep learning and data could affect our lives. The original author is unknown.

  • Hello! Gordon's pizza?
  • No sir, it is Google's pizza.
  • So is it a wrong number?
  • No sir, Google bought it.
  • OK. Take my order, please.
  • Well, sir, do you want the usual?
  • The usual? You know me?
  • According to our caller ID, the last 12 times you ordered pizza with cheeses, sausage and thick crust.
  • OK! That's it.
  • May I suggest ricotta, arugula and dried tomato this time?
  • What? I hate vegetables.
  • Your cholesterol is not good.
  • How do you know?
  • Through the subscriber guide. We have the results of your blood tests for the last seven years.
  • Okay, but I do not want this pizza. I already take medicine.
  • You have not taken your medicine regularly. Four months ago, you bought only one box of 30 tablets at Drug Sale Network.
  • I bought more from another drugstore.
  • It is not showing on your credit card.
  • I paid in cash.
  • But you did not withdraw that much cash according to your bank statement.
  • I have other sources of cash.
  • That is not showing on your last tax form, unless you bought them with undeclared income.
  • What the hell? Enough! I am sick of Google, Facebook, Twitter and WhatsApp. I am going to an island without the internet, where there is no cell phone line and no one to spy on me.
  • I understand, sir, but you need to renew your passport. It expired five weeks ago.

Thanks for reading.

Ekaba Bisong is a Ph.D. researcher at the University of Victoria and the founder of SiliconBlast. More about me