Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Hands-On Deep Learning Algorithms with Python
Hands-On Deep Learning Algorithms with Python

Hands-On Deep Learning Algorithms with Python: Master deep learning algorithms with extensive math by implementing them using TensorFlow

Arrow left icon
Profile Icon Sudharsan Ravichandiran
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.1 (13 Ratings)
Paperback Jul 2019 512 pages 1st Edition
eBook
€8.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Sudharsan Ravichandiran
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.1 (13 Ratings)
Paperback Jul 2019 512 pages 1st Edition
eBook
€8.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€8.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Hands-On Deep Learning Algorithms with Python

Introduction to Deep Learning

Deep learning is a subset of machine learning inspired by the neural networks in the human brain. It has been around for a decade, but the reason it is so popular right now is due to the computational advancements and availability of the huge volume of data. With a huge volume of data, deep learning algorithms outperform classic machine learning. It has already been transfiguring and extensively used in several interdisciplinary scientific fields such as computer vision, natural language processing (NLP), speech recognition, and many others.

In this chapter, we will learn about the following topics:

  • Fundamental concepts of deep learning
  • Biological and artificial neurons
  • Artificial neural network and its layers
  • Activation functions
  • Forward and backward propagation in ANN
  • Gradient checking algorithm
  • Building an artificial neural network from scratch...

What is deep learning?

Deep learning is just a modern name for artificial neural networks with many layers. What is deep in deep learning though? It is basically due to the structure of the artificial neural network (ANN). ANN consists of some n number of layers to perform any computation. We can build an ANN with several layers where each layer is responsible for learning the intricate patterns in the data. Due to the computational advancements, we can build a network even with 100s or 1000s of layers deep. Since the ANN uses deep layers to perform learning we call it as deep learning and when ANN uses deep layers to learn we call it as a deep network. We have learned that deep learning is a subset of machine learning. How does deep learning differ from machine learning? What makes deep learning so special and popular?

The success of machine learning lies in the right set of...

Biological and artificial neurons

Before going ahead, first, we will explore what are neurons and how neurons in our brain actually work, and then we will learn about artificial neurons.

A neuron can be defined as the basic computational unit of the human brain. Neurons are the fundamental units of our brain and nervous system. Our brain encompasses approximately 100 billion neurons. Each and every neuron is connected to one another through a structure called a synapse, which is accountable for receiving input from the external environment, sensory organs for sending motor instructions to our muscles, and for performing other activities.

A neuron can also receive inputs from the other neurons through a branchlike structure called a dendrite. These inputs are strengthened or weakened; that is, they are weighted according to their importance and then they are summed together in...

ANN and its layers

While neurons are really cool, we cannot just use a single neuron to perform complex tasks. This is the reason our brain has billions of neurons, stacked in layers, forming a network. Similarly, artificial neurons are arranged in layers. Each and every layer will be connected in such a way that information is passed from one layer to another.

A typical ANN consists of the following layers:

  • Input layer
  • Hidden layer
  • Output layer

Each layer has a collection of neurons, and the neurons in one layer interact with all the neurons in the other layers. However, neurons in the same layer will not interact with one another. This is simply because neurons from the adjacent layers have connections or edges between them; however, neurons in the same layer do not have any connections. We use the term nodes or units to represent the neurons in the artificial neural network...

Exploring activation functions

An activation function, also known as a transfer function, plays a vital role in neural networks. It is used to introduce non-linearity in neural networks. As we learned before, we apply the activation function to the input, which is multiplied by weights and added to the bias, that is, , where z = (input * weights) + bias and is the activation function. If we do not apply the activation function, then a neuron simply resembles the linear regression. The aim of the activation function is to introduce a non-linear transformation to learn the complex underlying patterns in the data.

Now let's look at some of the interesting commonly used activation functions.

The sigmoid function

The sigmoid...

Forward propagation in ANN

In this section, we will see how an ANN learns where neurons are stacked up in layers. The number of layers in a network is equal to the number of hidden layers plus the number of output layers. We don't take the input layer into account when calculating the number of layers in a network. Consider a two-layer neural network with one input layer, , one hidden layer, , and one output layer, , as shown in the following diagram:

Let's consider we have two inputs, and , and we have to predict the output, . Since we have two inputs, the number of neurons in the input layer will be two. We set the number of neurons in the hidden layer to four, and, the number of neurons in the output layer to one. Now, the inputs will be multiplied by weights, and then we add bias and propagate the resultant value to the hidden layer where the activation function...

How does ANN learn?

If the cost or loss is very high, then it means that our network is not predicting the correct output. So, our objective is to minimize the cost function so that our neural network predictions will be better. How can we minimize the cost function? That is, how can we minimize the loss/cost? We learned that the neural network makes predictions using forward propagation. So, if we can change some values in the forward propagation, we can predict the correct output and minimize the loss. But what values can we change in the forward propagation? Obviously, we can't change input and output. We are now left with weights and bias values. Remember that we just initialized weight matrices randomly. Since the weights are random, they are not going to be perfect. Now, we will update these weight matrices ( and ) in such a way that our neural network gives a correct...

Debugging gradient descent with gradient checking

We just learned how gradient descent works and how to code the gradient descent algorithm from scratch for a simple two-layer network. But implementing gradient descent for complex neural networks is not a simple task. Apart from implementing, debugging a gradient descent for complex neural network architecture is again a tedious task. Surprisingly, even with some buggy gradient descent implementations, the network will learn something. However, apparently, it will not perform well compared to the bug-free implementation of gradient descent.

If the model does not give us any errors and learns something even with buggy implementations of the gradient descent algorithm, how can we evaluate and ensure that our implementation is correct? That is why we use the gradient checking algorithm. It will help us to validate our implementation...

Putting it all together

Putting all the concepts we have learned so far together, we will see how to build a neural network from scratch. We will understand how the neural network learns to perform the XOR gate operation. The XOR gate returns 1 only when exactly only one of its inputs is 1, else it returns 0 as shown in the following table:

Building a neural network from scratch

To perform the XOR gate operation, we build a simple two-layer neural network, as shown in the following diagram. As you can see, we have an input layer with two nodes: a hidden layer with five nodes and an output layer comprising one node:

We will understand step-by-step how a neural network learns the XOR logic:

  1. First, import the libraries:
import...

Summary

We started off the chapter by understanding what deep learning is and how it differs from machine learning. Later, we learned how biological and artificial neurons work, and then we explored what is input, hidden, and output layer in the ANN, and also several types of activation functions.

Going ahead, we learned what forward propagation is and how ANN uses forward propagation to predict the output. After this, we learned how ANN uses backpropagation for learning and optimizing. We learned an optimization algorithm called gradient descent that helps the neural network to minimize the loss and make correct predictions. We also learned about gradient checking, a technique that is used to evaluate the gradient descent. At the end of the chapter, we implemented a neural network from scratch to perform the XOR gate operation.

In the next chapter, we will learn about one of...

Questions

Let's evaluate our newly acquired knowledge by answering the following questions:

  1. How does deep learning differ from machine learning?
  2. What does the word deep mean in deep learning?
  3. Why do we use the activation function?
  4. Explain dying ReLU problem.
  5. Define forward propagation.
  6. What is back propagation?
  7. Explain gradient checking.

Further reading

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Get up to speed with building your own neural networks from scratch
  • Gain insights into the mathematical principles behind deep learning algorithms
  • Implement popular deep learning algorithms such as CNNs, RNNs, and more using TensorFlow

Description

Deep learning is one of the most popular domains in the AI space that allows you to develop multi-layered models of varying complexities. This book introduces you to popular deep learning algorithms—from basic to advanced—and shows you how to implement them from scratch using TensorFlow. Throughout the book, you will gain insights into each algorithm, the mathematical principles involved, and how to implement it in the best possible manner. The book starts by explaining how you can build your own neural networks, followed by introducing you to TensorFlow, the powerful Python-based library for machine learning and deep learning. Moving on, you will get up to speed with gradient descent variants, such as NAG, AMSGrad, AdaDelta, Adam, and Nadam. The book will then provide you with insights into recurrent neural networks (RNNs) and LSTM and how to generate song lyrics with RNN. Next, you will master the math necessary to work with convolutional and capsule networks, widely used for image recognition tasks. You will also learn how machines understand the semantics of words and documents using CBOW, skip-gram, and PV-DM. Finally, you will explore GANs, including InfoGAN and LSGAN, and autoencoders, such as contractive autoencoders and VAE. By the end of this book, you will be equipped with all the skills you need to implement deep learning in your own projects.

Who is this book for?

If you are a machine learning engineer, data scientist, AI developer, or anyone looking to delve into neural networks and deep learning, this book is for you. Those who are completely new to deep learning, but have some experience in machine learning and Python programming will also find the book very helpful.

What you will learn

  • Implement basic-to-advanced deep learning algorithms
  • Master the mathematics behind deep learning algorithms
  • Become familiar with gradient descent and its variants, such as AMSGrad, AdaDelta, Adam, and Nadam
  • Implement recurrent networks, such as RNN, LSTM, GRU, and seq2seq models
  • Understand how machines interpret images using CNN and capsule networks
  • Implement different types of generative adversarial network, such as CGAN, CycleGAN, and StackGAN
  • Explore various types of autoencoder, such as Sparse autoencoders, DAE, CAE, and VAE

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jul 25, 2019
Length: 512 pages
Edition : 1st
Language : English
ISBN-13 : 9781789344158
Category :
Languages :
Concepts :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Jul 25, 2019
Length: 512 pages
Edition : 1st
Language : English
ISBN-13 : 9781789344158
Category :
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 91.97
Advanced Deep Learning with Python
€36.99
Hands-On Deep Learning Algorithms with Python
€29.99
Hands-On Deep Learning Architectures with Python
€24.99
Total 91.97 Stars icon
Banner background image

Table of Contents

16 Chapters
Section 1: Getting Started with Deep Learning Chevron down icon Chevron up icon
Introduction to Deep Learning Chevron down icon Chevron up icon
Getting to Know TensorFlow Chevron down icon Chevron up icon
Section 2: Fundamental Deep Learning Algorithms Chevron down icon Chevron up icon
Gradient Descent and Its Variants Chevron down icon Chevron up icon
Generating Song Lyrics Using RNN Chevron down icon Chevron up icon
Improvements to the RNN Chevron down icon Chevron up icon
Demystifying Convolutional Networks Chevron down icon Chevron up icon
Learning Text Representations Chevron down icon Chevron up icon
Section 3: Advanced Deep Learning Algorithms Chevron down icon Chevron up icon
Generating Images Using GANs Chevron down icon Chevron up icon
Learning More about GANs Chevron down icon Chevron up icon
Reconstructing Inputs Using Autoencoders Chevron down icon Chevron up icon
Exploring Few-Shot Learning Algorithms Chevron down icon Chevron up icon
Assessments Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.1
(13 Ratings)
5 star 61.5%
4 star 15.4%
3 star 0%
2 star 15.4%
1 star 7.7%
Filter icon Filter
Top Reviews

Filter reviews by




Surender m Sep 06, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
It’s a great book that’s one should have in their collection. Simple language. Easy to understand with python codes.Great book to start learning.
Amazon Verified review Amazon
Reshma Dec 01, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I completed first chapter. Book so far looks concise, simple and up to the point. I will recommend it to a beginner.
Amazon Verified review Amazon
kalyan reddy k Aug 23, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great material for learning, One should go through this book to get the best out of the Deep learning techniques. Besides theory, one can go through the coding for each technique which helps to understand how things work. GREAT to have one.
Amazon Verified review Amazon
Vikash Jan 01, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Best book for mastering Deep Learning. It will give you in-depth knowledge on Basic to Advance Deep Learning algorithm with mathematics behind each algorithm. Each page made you hungry to go further reading. I recommend it to everyone who wanted to learn Deep Learning from Basic to advance level. Best book ever on Deep Learning.Thanks Sudharsan for writing this amazing book on Deep Learning.
Amazon Verified review Amazon
Amazon Customer Sep 05, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Literally it is the best book on Deep Learning I have ever read. Never have I thought, someone could explain DL in such a simple way that too by making all the complex math very simple. After reading this book, I am literally in love with math.This book is for all sets of audiences. Interested in DL applications? Or wanna learn DL with detailed math or wanna learn DL intuitively? This has covered everything from basic algorithms to advanced algorithms like stack gan, cycle gan, VAE, transformer and more that too with hands-on application.Loved it! Loved it! Loved it! very much.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.