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).

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.

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

### 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.

## 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.

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.

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

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.

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.

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

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

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.

## 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.

All the computations performed using TensorFlow involve Tensors.

Below is a simple architecture of how TensorFlow works:

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:

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

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

4. Print the shape of train and test dataset:

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

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

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

8. Check the data type of the label column:

9. Add features to the continuous and categorical variables:

10. Create continuous feature variables:

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

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

13. Assign all the features and define a function:

14. Train the model:

15. Evaluate the model:

16. Square the ages:

17. Create new data frames for training and testing:

18. Print the shapes of the data frames:

19. Define the newly created variable:

20. Create a linear classifier model:

21. Defining a function with the newly created column:

22. Train the model:

23. Evaluate the model:

24. Prediction from the model:

25. Predicting the output from the test set:

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

Upon completion of the introduction to deep learning tutorial, master deep learning concepts and implement deep learning algorithms with the Deep Learning with TensorFlow Training Course.

### 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 Deep Learning Course, 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.