Lesson 8 of 17By Avijeet Biswal

Last updated on Jan 28, 20214335#### Deep Learning Tutorial for Beginners: A Step-by-Step Guide

Overview#### What is Deep Learning and How Does It Works [Explained]

Lesson - 1#### The Best Introduction to Deep Learning - A Step by Step Guide

Lesson - 2#### Top 10 Deep Learning Applications Used Across Industries

Lesson - 3#### What is Neural Network: Overview, Applications, and Advantages

Lesson - 4#### Neural Networks Tutorial

Lesson - 5#### Top 8 Deep Learning Frameworks

Lesson - 6#### Top 10 Deep Learning Algorithms You Should Know in 2021

Lesson - 7#### An Introduction To Deep Learning With Python

Lesson - 8#### What is Tensorflow: Deep Learning Libraries and Program Elements Explained

Lesson - 9#### How To Install TensorFlow on Ubuntu

Lesson - 10#### What Is TensorFlow 2.0? The Best Guide to Understand TensorFlow

Lesson - 11#### TensorFlow Tutorial for Beginners: Your Gateway to Building Machine Learning Models

Lesson - 12#### Convolutional Neural Network Tutorial

Lesson - 13#### Recurrent Neural Network (RNN) Tutorial for Beginners

Lesson - 14#### The Best Introduction to What GANs Are

Lesson - 15#### What Is Keras? The Best Introductory Guide to Keras

Lesson - 16#### 30 Frequently asked Deep Learning Interview Questions and Answers

Lesson - 17

Want to know in-depth about Deep Learning? Deep Learning has seen significant advancements with companies looking to build intelligent systems using vast amounts of unstructured data. Deep Learning works on the theory of artificial neural networks. In this article, we’ll learn about the basics of Deep Learning with Python and see how neural networks work.

Following are the topics that this article will explore:

- What is Deep Learning?
- What is a Neural Network?
- Activation Function
- Cost Function
- How do Neural Networks work?
- Gradient Descent
- What is TensorFlow?
- Deep Learning with Python Demo

Deep Learning is a part of machine learning that deals with algorithms inspired by the structure and function of the human brain. It uses artificial neural networks to build intelligent models and solve complex problems. We mostly use deep learning with unstructured data.

Let’s now look understand the basics of neural networks in this Deep Learning with Python article.

A neural network is a machine modeled on the human brain. Each layer consists of nodes. The connections between the nodes depict the flow of information from one layer to the next. The neurons are connected with the help of weights. It then feeds the inputs to a neuron. After this, it processes the data and gives an output.

The following is an example of a basic neural network.

A neural network has three main layers.

- Input Layer: This layer is responsible for accepting the inputs.
- Hidden Layer: This layer processes the input data to find out hidden information and performs feature extraction.
- Output Layer: This layer gives the desired output.

Depicted below is an example of a neural network that takes the pixels of an image, processes it using the hidden layers, and classifies the shape of the image. Here, it is a triangle.

The following operations are performed within each neuron,

- The product of each input value and the weight of the channel it has passed over is found.
- It computes the sum of the weighted products. We call this the weighted sum.
- It adds a bias unique to the neuron to the weighted sum.
- We then subject the final sum to a particular function.

There are a number of activation functions available in a neural network.

The sigmoid function is used for models where we have to predict the probability as an output. It exists between 0 and 1.

It is a threshold-based activation function. It makes the function active and fired if the value of x is greater than a certain value, else not.

It is the most widely used activation function and gives an output of X if X is positive and 0 otherwise.

This function is similar to the Sigmoid function and is bound to the range (-1, 1).

The Cost function returns the difference between the neural network’s predicted output and the actual output from a set of labeled training data. The least-cost value can be obtained by making adjustments to the weights and biases iteratively throughout the training process.

The formula for cost function is:

Where Y hat is the predicted value and Y is the actual output.

- A network comprises layers of neurons. It associates each neuron with a random number called the bias.
- Neurons present in each layer transmit information to neurons of the next layer over channels.
- These channels are associated with values called weights.
- The weights, along with the biases, determine the information that is passed over from neuron to neuron.
- Neurons from each layer transmit information to neurons of the next layer.
- The output layer gives a predicted output.

Let’s go ahead and build a neural network to predict bike prices based on a few of its features.

- The input features such as cc, mileage, and abs are fed to the input layer.
- The hidden layers help in improving output accuracy.
- Each of the connections has a weight assigned to it. The neuron takes a subset of the inputs and processes it.

----> x1*w1 + x2*w2 + b1

----> Φ(x1* w1 + x2*w2 + b1), where Φ is an activation function.

- The information reaching the neuron’s in the hidden layer is subjected to the respective activation function.
- It sends the processed information to the output layer over the weighted channels.
- It compares the predicted output to the original output value.
- A cost function determines the error in prediction and reports it back to the neural network. We call this backpropagation.
- The weights are adjusted to minimize the error.
- We now train the network using the new weights.
- Once again, it determines the cost, and it continues backpropagation until the cost cannot be reduced any further.
- We consider our neural network trained when the value for the cost function is minimum.

Now, let’s learn more about another topic in the Deep Learning with Python article, i.e., Gradient Descent.

Gradient Descent is an approach to minimize the cost function. The gradient is a numeric calculation that allows us to adjust the parameters of a neural network in order to minimize the output deviation. The cost function is plotted against the predicted value, and the goal is to find the particular value of weight for which the loss is minimum.

Several popular and widely used deep learning frameworks help to build neural network models. Some of the common ones are Tensorflow, Keras, Pytorch, and DL4J.

In our hands-on demo, we have used the TensorFlow library to create the model.

Developed by Google, TensorFlow is an open-source library used to define and run computations on tensors. Tensors are just another name for multi-dimensional arrays.

It can run on either CPU or GPU. It can create data flow graphs that have nodes and edges. TensorFlow is popularly used for Machine Learning applications such as Neural Networks.

Now, let’s move on to the final section of our article on Deep Learning with Python, i.e., to build a model that can predict handwritten digits using the MNIST database.

- Import the required libraries.
- Load the dataset.
- Check the total number of training and testing samples.
- Visualize the data.
- Build the model.
- Loss and Optimization.
- Test the model and find the accuracy.

As is evident above, our model has an accuracy of 91%, which is decent.

Master deep learning concepts and the TensorFlow open-source framework with the PGP in AI and Machine Learning. Get certified today!

After completing this article, you would have learned Deep Learning basics and understood how neural networks work. You looked at the different techniques in Deep Learning and implemented a demo to classify handwritten digits using the MNIST database.

If you have any questions related to this article on Deep Learning with Python, please place them in the comments section of this article. Our experts will resolve your queries at the earliest!

Name | Date | Place | |
---|---|---|---|

Deep Learning with Keras and TensorFlow | 17 Jul -8 Aug 2021, Weekend batch | Your City | View Details |

Deep Learning with Keras and TensorFlow | 20 Aug -11 Sep 2021, Weekdays batch | New York City | View Details |

Avijeet is a Senior Research Analyst at Simplilearn. Passionate about Data Analytics, Machine Learning, and Deep Learning, Avijeet is also interested in politics, cricket, and football.

Deep Learning with Keras and TensorFlow

9862 Learners

Artificial Intelligence Engineer

11049 Learners

Lifetime Access*

*Lifetime access to high-quality, self-paced e-learning content.

Explore Category- Video Tutorial
The Best Introduction to Deep Learning - A Step by Step Guide

- Ebook
Deep Learning Interview Guide

- Article
Keras vs Tensorflow vs Pytorch: Understanding the Most Popular Deep Learning Frameworks

- Video Tutorial
What Is Keras? The Best Introductory Guide to Keras

- Video Tutorial
What Is TensorFlow 2.0? The Best Guide to Understand TensorFlow

- Ebook
Introduction to Machine Learning: A Beginner's Guide

prevNext

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