Back to Blog

What is Deep Learning? The Guide

13
Oct
2023
Technology
What is Deep Learning (DL)?

Deep Learning is one of the most important Machine Learning Subfields. It’s responsible for many tools we use every day and take for granted.

That goes from ChatGPT, Midjourney to Siri and Netflix. Deep Learning’s power extends to self-driving cars and diagnosing breast cancer a year earlier than standard procedures, increasing detection by 20%.

Software development products that use Artificial Intelligence (AI) and Machine Learning (ML) are becoming increasingly popular, especially if they use Deep Learning, which is essentially the secret for building super smart “human-like” products. Let’s dive right into it.

What is Deep Learning?

As mentioned, Deep Learning is a Machine Learning subfield heavily inspired by how the human brain works.

Deep Learning Models learn from massive amounts of information and data to think like us, or at least in a very similar way, involving Neural Network architecture composed of neurons inspired by our brain’s neurons.

A neural network with more than three layers technically classifies as a Deep Neural Network. That explains why they called it “Deep” and why models like these can perform such complex tasks.

Deep Learning's common general uses include image, text, speech recognition, image classification, language translation, difficult predictions, and fraud detection. Machine Learning Engineers also do a lot of data refining and Natural Language Processing with Deep Learning.

Deep Learning Main Components

Deep Learning Neurons

Engineers typically describe them as “nodes” or “perceptrons” that receive and pass information. Even though inspired by biological neurons, they’re not physical entities, they’re computational units or functions that perform mathematical operations with the data they receive.

Information can come from raw data or a previous layer of neurons.

There are two important parameters when it comes to data: Weight and Bias. Weight determines how important an input is in the learning process, and Bias represents the gap between the result and the desired result. Neurons use these parameters and an activation function to produce an output.

The activation function decides whether the neuron should produce an outcome based on a certain threshold value.

Deep Learning Neural Networks

Think of Neural Networks or Artificial Neural Networks (ANN) as the heart and soul of Deep Learning and Machine Learning algorithms. They consist of multiple node layers interconnected to each other, typically having at least three layers of nodes: an input, a hidden, and an output layer.

Each node layer extracts patterns from its inputs through a process called training or learning. Therefore, the information that passes from one neuron or node to another is crucial to the next layer’s activation.

As you can see, each layer refines the learning process, allowing the Deep Learning model to solve complex tasks. In an image recognition task, you can imagine a grid of pixels representing one Neural Network layer.

Neurons analyze each pixel to test if their patterns match an intended value. Some common activation functions are Sigmoid and Softmax, which outputs a number between o and 1.

Deep Learning Input Layers

The input layer is the first that receives raw data and passes it to the hidden layers in the Artificial Neural Network. As they are the entry point for certain Deep Learning models, input layers normally don’t perform difficult tasks.

Thus, they don't run activation functions or transformations or add nonlinearity. Their core value is preserving the structure and representation of the data.

Deep Learning Hidden Layers

Hidden layers connect the input and output layers in the Artificial Neural Network (ANN), where the heavy work occurs. Hidden layers receive the values from the input layer. Remember what we were discussing about the importance of Weights and Biases?

Well, Hidden Layers are the ones that implement them and activate different functions in the learning process. Fun fact: People call them hidden because their functions and operations are not directly accessible!

For example, if a Hidden Layer tries to recognize a certain number in an image, the nodes in the first layer identify a loop on top of the image. That prompts the model to think the number could be a “9” because it has a loop on top.

Then, the second layer finds there’s a straight vertical line, to make the model a bit more sure that the number could be a nine. As you can see, if the Deep Learning model has more Hidden Layers, it’ll have more individual and relevant features to analyze and ensure it gives the right answer.

Deep Learning Output Layers

The Output layer receives outputs from the hidden layers, providing a final answer or indicating the likelihood of an event being true. For example, an output layer with two neurons can produce probabilities for binary classifications. Consider the example above, where the model tries to identify a digit or a number in an image. If that were the case, the output layer would have ten nodes representing numbers from “0” to “10.”

How does Deep Learning work?

The main goal of an ANN is to learn and make decisions similarly to how our brains do it. It processes information using multiple layers that analyze patterns by applying mathematical operations. The hidden layers of nodes or neurons multiply the data passed by the input layer by Weights and adding Bias.

As the model processes more data, it automatically adjusts Weights and Bias, improving its topic’s understanding.

As a matter of fact, the efficacy of the learning process goes down to finding the right Weights and Biases for every node. This way, the model learns to analyze and solve complex problems.

That process, called Backpropagation, also enables the model to make accurate predictions and classifications. That’s how complex systems that perform voice and image recognition and make autonomous decisions are born.

Let’s consider an oversimplified example of how math operations in each neuron might look. Each neuron in a given layer multiplies its input (x) by its corresponding Weight (w) and then adds Bias.

The weighted sum (z) that results from that operation determines if the neuron fires if it exceeds a certain threshold (θ).

z = (w₁ * x₁) + (w₂ * x₂) + (w₃ * x₃) + ... + (w_n * x_n) + b

Let’s use Python to exemplify what happens next.

if z >= θ:
print(‘neuron fires’)
else:
print(‘neuron does not fire’)

Note that the next layer will consider the activations (a) in that example, multiplying them by the respective Weights. That’s why we mentioned that activations in one layer affect the activations in the next layer. Here’s how it would look.

z = (w₁ * a₁) + (w₂ * a₂) + (w₃ * a₃) + ... + (w_n * a_n) + b

It’s common practice to apply a function like Sigmoid or Softmax to “z” to get a value between “0” and “1.”

How to Build Deep Learning Models?

It’s important to know some basic math concepts before diving into anything related to Machine Learning, and Deep Learning is not an exception.

Thankfully, programming libraries and frameworks can help optimize much of the math in training a Deep Learning Model.

Yet, having a grasp of Basic Notation in Linear Algebra, using Python libraries and frameworks like Keras, TensorFlow, PyTorch, and NumPy is highly recommended.

These tools allow you to easily organize your data into training and testing sets as you define the neural network's architecture. Then, it’s key to select the right functions and optimization algorithms.

The next step is to train the model using Backpropagation iteratively. It’s also important to specify Epochs and Batch sizes; you can see how at the bottom of the following example.

# Import necessary libraries
  from keras.models import Sequential
  from keras.layers import Dense
# Create a Sequential model
  model = Sequential()
# Add an input layer and a hidden layer with 10 neurons
  model.add(Dense(10, input_dim=8, activation='relu'))
# Add an output layer with 1 neuron with a sigmoid activation function
  model.add(Dense(1, activation='sigmoid'))
# Compile the model
  model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
# Train the model (with some example data)
# X_train and y_train need to be provided as per your dataset
  model.fit(X_train, y_train, epochs=150, batch_size=10)

Epochs represent a pass through the dataset. Thus, 150 Epochs in the previous example mean the neural network will pass the entire dataset forward and backward 150 times.

The Batch sizes represent the training examples used in every iteration. In the example, the batch size was equal to 10, meaning 1000 samples would take 100 iterations to complete one Epoch.

Deep Learning vs Machine Learning

Deep Learning is a subset of Machine Learning, so it wouldn’t be fair to say that one is better than the other. In fact, one of the main purposes of Deep Learning is to make Machine Learning processes more powerful and efficient, allowing for Unsupervised Learning.

Training a model before Deep Learning came into play was extremely difficult and time-consuming. One of the main challenges was learning from unstructured or unlabelled data. Yet, that’s not a problem for Deep Learning models.

Plus, they leverage their knowledge to make decisions in fields for which they didn’t receive direct training. That’s how YouTube, Shopify, Netflix, and Amazon give recommendations based on User Activity.

That also explains why they say Deep Learning Models can find “hidden relationships” in complex data. On top of that, some models allow for continuous improvement and end-to-end learning.

Why is Deep Learning Important?

Deep Learning is responsible for many of the major technological enhancements we’ve seen in the last few years. That goes way beyond the entertainment industry and the popular Natural Language Processing (NLP).

Both the security and Cybersecurity industry have also greatly benefited from Deep Learning. ANNs allow fraud detection, drone surveillance systems, predictive analysis, and facial recognition.

Also, efficient malware, cyber threats, and phishing attack detection and responses are possible thanks to Deep Learning solutions.

Deep Learning power also extends to the Healthcare industry, assisting in medical image analysis, drug discovery, diagnoses, and even treatment planning. ANNs also provide more detailed user insights, which can help deliver better UX/UI solutions.

We’ve also seen how Deep Learning applications have radically changed almost every working sector with tools like ChatGPT and Midjourney. Environmental sciences and Astronomy are disciplines that also take a huge advantage of Deep Learning.

Conclusion

As you can see, modern technological advances in almost any field and Deep Learning go hand in hand. In case you were wondering, it’s primarily Data Scientists, Data Engineers, and Machine Learning Engineers the ones who delve deep into Deep Learning.

Yet, since it’s become so popular, some software developers, business analysts, and AI researchers are getting into Deep Learning solutions. ANNs also greatly impact Augmented Reality (AR), Business Strategies, Generative Adversarial Networks (GANs), and Cloud Computing.

Almost any aspect of the product Development Lifecycle. It’s clear that Deep Learning will shape the future of our work.