The Best Introduction to Deep Learning - A Step by Step Guide

Do you ever wonder how Amazon Alexa or Google Translate works? Well, they all work because of deep learning. A type of machine learning (ML), deep learning has revolutionized the world with its advancement in technology, finding its application in every sector of business.

What is Deep Learning?

Before we get deeper into deep learning, its applications and platforms, the first thing this introduction to deep learning tutorial will help you understand is what exactly is deep learning. Deep learning is a subfield of machine learning that deals with algorithms inspired by the structure and function of the brain. Deep learning is a subset of machine learning, which is a part of artificial intelligence (AI).

deeplearning

Artificial intelligence is the ability of a machine to imitate intelligent human behavior. Machine learning allows a system to learn and improve from experience automatically. Deep learning is an application of machine learning that uses complex algorithms and deep neural nets to train a model. 

Your AI/ML Career is Just Around The Corner!

AI Engineer Master's ProgramExplore Program
Your AI/ML Career is Just Around The Corner!

Applications of Deep Learning

Next up in this introduction to deep learning tutorial, let’s learn about some of the top applications of deep learning. Deep learning is widely used to make weather predictions about rain, earthquakes, and tsunamis. It helps in taking the necessary precautions. With deep learning, machines can comprehend speech and provide the required output. It enables the machines to recognize people and objects in the images fed to it. Deep learning models also help advertisers leverage data to perform real-time bidding and targeted display advertising. In the next section  introduction to deep learning tutorial, we will cover the need and importance of deep learning.

Importance of Deep Learning

  • Machine learning works only with sets of structured and semi-structured data, while deep learning works with both structured and unstructured data
  • Deep learning algorithms can perform complex operations efficiently, while machine learning algorithms cannot
  • Machine learning algorithms use labeled sample data to extract patterns, while deep learning accepts large volumes of data as input and analyzes the input data to extract features out of an object
  • The performance of machine learning algorithms decreases as the number of data increases; so to maintain the performance of the model, we need a deep learning

What are Neural Networks?

Now that you know what exactly is deep learning, it’s application and importance, next up in this introduction to deep learning tutorial, let us look at neural networks and its operations. A neural network is a system modeled on the human brain, consisting of an input layer, multiple hidden layers, and an output layer. Data is fed as input to the neurons. The information is transferred to the next layer using appropriate weights and biases. The output is the final value predicted by the artificial neuron.

Each neuron in a neural network performs the following operations:

  • The product of each input and the weight of the channel it is passed over is found
  • The sum of the weighted products is computed, which is called the weighted sum
  • A bias value of the neuron is added to the weighted sum
  • The final sum is then subjected to a particular function known as the activation function

activation

Your AI/ML Career is Just Around The Corner!

AI Engineer Master's ProgramExplore Program
Your AI/ML Career is Just Around The Corner!

Cost Function

The cost function is one of the significant components of a neural network. The cost value is the difference between the neural nets predicted output and the actual output from a set of labeled training data. The least-cost value is obtained by making adjustments to the weights and biases iteratively throughout the training process.

cost-function

How Do Neural Networks Work?

In the next section of this introduction to deep learning the neural network will be trained to identify shapes. The shapes are images of 28*28 pixels.

pixel

Each pixel is fed as input to the neurons in the first layer. Hidden layers improve the accuracy of the output. Data is passed on from layer to layer overweight channels. Each neuron in one layer is weighted to each of the neurons in the next layer.

hidden

Each neuron in the first hidden layer takes a subset of the inputs and processes it. All the inputs are multiplied by their respective weights and a bias is added. The output of the weighted sum is applied to an activation function. The results of the activation function determine which neurons will be activated in the following layer.

Step 1: x1*w1 + x2*w2 + b1

Step 2: Φ(x1* w1 + x2*w2 + b1)

where Φ is an activation function

hidden-layer

The above steps are performed again to ensure the information reaches the output layer, after which a single neuron in the output layer gets activated based on the activation function’s value.

hidden-layers

As you can see, our actual input was a square, but the neural network predicted the output as a circle. So, what went wrong?

The neural network has to be trained until the predicted output is correct and the predicted output is compared to the actual output by calculating the cost function. 

The cost function is calculated using the formula where Y is the actual value and Y hat is the predicted value. The cost function determines the error in the prediction and reports it back to the neural network. This is called backpropagation.

backpropagation

The weights are adjusted to reduce the error. The network is trained with the new weights.

circle

Once again, the cost is determined and the backpropagation procedure is continued until the cost cannot be reduced any further.

square

Similarly, our network can be trained to predict circles and triangles too. 

Now that you have a good understanding of how neural networks work, let’s look at some of the important deep learning platforms.

Your AI/ML Career is Just Around The Corner!

AI Engineer Master's ProgramExplore Program
Your AI/ML Career is Just Around The Corner!

Deep Learning Platforms

In the following section of the introduction to deep learning, you will learn about several deep learning platforms and when they are used.

Torch

The torch was developed using the LUA language with an implementation in C. Torch’s Python implementation is called PyTorch.

Keras

Keras is a Python framework for deep learning. Its USP is reusability of code for CPU and GPU.

TensorFlow

TensorFlow is an open-source deep-learning library developed by Google. It’s developed in C++ and has its implementation in Python. Keras can now be run on top of TensorFlow.

DL4J

Deep Learning for Java (DL4J) is the first deep learning library written for Java and Scala. It’s integrated with Hadoop and Apache Spark.

Google’s TensorFlow is currently the most popular learning library in the world. It’s based on the concept of tensors, which are vectors or matrices of n dimensions.

Below is an example of Tensors having 1D, 2D, and multidimensionality.

tensor

All the computations performed using TensorFlow involve Tensors.

Below is a simple architecture of how TensorFlow works:

tensorflow

We’ll use the adult data set from the UCI Machine Learning Repository and predict whether the income of a person exceeds $50K/yr based on specific criteria.

The data set has the following attributes such as:

  • age
  • work-class
  • fnlwgt (final weight)
  • education
  • education-num
  • marital-status
  • occupation
  • relationship
  • race
  • sex
  • capital-gain
  • capital-loss
  • hours-per-week
  • native-country
  • salary

Let’s get started with the demo:

1. Import the required libraries:

libraries

2. Assign the paths where the data sets are located and the column variables:

column-variables

3. Create the test and train data frames using the Pandas library:

dataframes

4. Print the shape of train and test dataset:

train

5. Print the data type of each column from the training dataset:

training-dataset

6. Set the “label” column values to 0, if it’s <=50K and 1 if it’s >=50K

label

7. Count the total number of unique values in the datasets:

unique
 8. Check the data type of the label column:

8

9. Add features to the continuous and categorical variables:

9-variable

10. Create continuous feature variables:

feature-variable

11. Build a relationship and create categorical features with buckets:

buckets

12. Create the model with two classes and continuous and categorical features:

12-model

13. Assign all the features and define a function:

13-function

14. Train the model:

14-model

15. Evaluate the model:

15-model

15-accuracy

16. Square the ages:

squarethe

17. Create new data frames for training and testing:

17-testing

18. Print the shapes of the data frames:

18

19. Define the newly created variable:

19

20. Create a linear classifier model:

20-model

21. Defining a function with the newly created column:

21-function

22. Train the model:

22-model.

23. Evaluate the model:

23-model

24. Prediction from the model:

24-model

25. Predicting the output from the test set:

25-1

25-2

As you can see, the model was successfully able to predict the outcome of two observations from the training dataset.

Become an AI and ML Expert in 2024

Discover the Power of AI and ML With UsEXPLORE NOW
Become an AI and ML Expert in 2024

Master introduction to deep learning with Simplilearn

After reading this introduction to deep learning tutorial, you should now understand more about how deep learning and neural networks work, as well as how a neuron is fired using weights, biases, and activation functions. You learned about TensorFlow and how tensors work. Finally, you know how to use TensorFlow to classify the salaries of people based on specific features. 

Curious about deep learning frameworks and want to get hands-on training too? Opt in to our Caltech Post Graduate Program in AI and Machine Learning, which is developed by industry leaders and aligned with the latest best practices. Enroll with Simplilearn and you’ll master deep learning concepts and models using Keras and TensorFlow frameworks and implement deep learning algorithms too.

About the Author

SimplilearnSimplilearn

Simplilearn is one of the world’s leading providers of online training for Digital Marketing, Cloud Computing, Project Management, Data Science, IT, Software Development, and many other emerging technologies.

View More
  • Disclaimer
  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, OPM3 and the PMI ATP seal are the registered marks of the Project Management Institute, Inc.