Book Image

Deep Learning with Hadoop

By : Dipayan Dev
Book Image

Deep Learning with Hadoop

By: Dipayan Dev

Overview of this book

This book will teach you how to deploy large-scale dataset in deep neural networks with Hadoop for optimal performance. Starting with understanding what deep learning is, and what the various models associated with deep neural networks are, this book will then show you how to set up the Hadoop environment for deep learning. In this book, you will also learn how to overcome the challenges that you face while implementing distributed deep learning with large-scale unstructured datasets. The book will also show you how you can implement and parallelize the widely used deep learning models such as Deep Belief Networks, Convolutional Neural Networks, Recurrent Neural Networks, Restricted Boltzmann machines and autoencoder using the popular deep learning library Deeplearning4j. Get in-depth mathematical explanations and visual representations to help you understand the design and implementations of Recurrent Neural network and Denoising Autoencoders with Deeplearning4j. To give you a more practical perspective, the book will also teach you the implementation of large-scale video processing, image processing and natural language processing on Hadoop. By the end of this book, you will know how to deploy various deep neural networks in distributed systems using Hadoop.
Table of Contents (16 chapters)
Deep Learning with Hadoop
About the Author
About the Reviewers
Customer Feedback


This book will teach you how to deploy large-scale datasets in deep neural networks with Hadoop for optimal performance.

Starting with understanding what deep learning is, and what the various models associated with deep neural networks are, this book will then show you how to set up the Hadoop environment for deep learning.

What this book covers

Chapter 1, Introduction to Deep Learning, covers how deep learning has gained its popularity over the last decade and is now growing even faster than machine learning due to its enhanced functionalities. This chapter starts with an introduction of the real-life applications of Artificial Intelligence, the associated challenges, and how effectively Deep learning is able to address all of these. The chapter provides an in-depth explanation of deep learning by addressing some of the major machine learning problems such as, The curse of dimensionality, Vanishing gradient problem, and the likes. To get started with deep learning for the subsequent chapters, the classification of various deep learning networks is discussed in the latter part of this chapter. This chapter is primarily suitable for readers, who are interested to know the basics of deep learning without getting much into the details of individual deep neural networks.

Chapter 2, Distributed Deep Learning for Large - Scale Data, explains that big data and deep learning are undoubtedly the two hottest technical trends in recent days. Both of them are critically interconnected and have shown tremendous growth in the past few years. This chapter starts with how deep learning technologies can be furnished with massive amount of unstructured data to facilitate extraction of valuable hidden information out of them. Famous technological companies such as Google, Facebook, Apple, and the like are using this large-scale data in their deep learning projects to train some aggressively deep neural networks in a smarter way. Deep neural networks, however, show certain challenges while dealing with Big data. This chapter provides a detailed explanation of all these challenges. The latter part of the chapter introduces Hadoop, to discuss how deep learning models can be implemented using Hadoop's YARN and its iterative Map-reduce paradigm. The chapter further introduces Deeplearning4j, a popular open source distributed framework for deep learning and explains its various components.

Chapter 3 , Convolutional Neural Network, introduces Convolutional neural network (CNN), a deep neural network widely used by top technological industries in their various deep learning projects. CNN comes with a vast range of applications in various fields such as image recognition, video recognition, natural language processing, and so on. Convolution, a special type of mathematical operation, is an integral component of CNN. To get started, the chapter initially discusses the concept of convolution with a real-life example. Further, an in-depth explanation of Convolutional neural network is provided by describing each component of the network. To improve the performance of the network, CNN comes with three most important parameters, namely, sparse connectivity, parameter sharing, and equivariant representation. The chapter explains all of these to get a better grip on CNN. Further, CNN also possesses few crucial hyperparameters, which help in deciding the dimension of output volume of the network. A detailed discussion along with the mathematical relationship among these hyperparameters can be found in this chapter. The latter part of the chapter focuses on distributed convolutional neural networks and shows its implementation using Hadoop and Deeplearning4j.

Chapter 4, Recurrent Neural Network, explains that it is a special type of neural network that can work over long sequences of vectors to produce different sequences of vectors. Recently, they have become an extremely popular choice for modeling sequences of variable length. RNN has been successfully implemented for various applications such as speech recognition, online handwritten recognition, language modeling, and the like. The chapter provides a detailed explanation of the various concepts of RNN by providing essential mathematical relations and visual representations. RNN possesses its own memory to store the output of the intermediate hidden layer. Memory is the core component of the recurrent neural network, which has been discussed in this chapter with an appropriate block diagram. Moreover, the limitations of uni-directional recurrent neural networks are provided, and to overcome the same, the concept of bidirectional recurrent neural network (BRNN) is introduced. Later, to address the problem of vanishing gradient, introduced in chapter 1, a special unit of RNN, called Long short-term Memory (LSTM) is discussed. In the end, the implementation of distributed deep recurrent neural network with Hadoop is shown with Deeplearning4j.

Chapter 5 , Restricted Boltzmann Machines, covers both the models discussed in chapters 3 and 4 and explains that they are discriminative models. A generative model called Restricted Boltzmann machine (RBM) is discussed in chapter 5. RBM is capable of randomly producing visible data values when hidden parameters are supplied to it. The chapter starts with introducing the concept of an Energy-based model, and explains how Restricted Boltzmann machines are related to it. Furthermore, the discussion progresses towards a special type of RBM known as Convolutional Restricted Boltzmann machine, which is a combination of both Convolution and Restricted Boltzmann machines, and facilitates in the extraction of the features of high dimensional images.

Deep Belief networks (DBN), a widely used multilayer network composed of several Restricted Boltzmann machines gets introduced in the latter part of the chapter.  This part also discusses how DBN can be implemented in a distributed environment using Hadoop. The implementation of RBM as well as distributed DBN using Deeplearning4j is discussed in the end of the chapter.

Chapter 6, Autoencoders, introduces one more generative model called autoencoder, which is generally used for dimensionality reduction, feature learning, or extraction. The chapter starts with explaining the basic concept of autoencoder and its generic block diagram.  The core structure of an autoencoder is basically divided into two parts, encoder and decoder. The encoder maps the input to the hidden layer, whereas the decoder maps the hidden layer to the output layer. The primary concern of a basic autoencoder is to copy certain aspects of the input layer to the output layer. The next part of the chapter discusses a type of autoencoder called sparse autoencoder, which is based on the distributed sparse representation of the hidden layer. Going further, the concept of deep autoencoder, comprising multiple encoders and decoders is explained in-depth with an appropriate example and block diagram. As we proceed, denoising autoencoder and stacked denoising autoencoder are explained in the latter part of the chapter. In conclusion, chapter 6 also shows the implementation of stacked denoising autoencoder and deep autoencoder in Hadoop using Deeplearning4j.

Chapter 7 , Miscellaneous Deep Learning Operations using Hadoop, focuses, mainly,on the design of three most commonly used machine learning applications in distributed environment. The chapter discusses the implementation of large-scale video processing, large-scale image processing, and natural language processing (NLP) with Hadoop. It explains how the large-scale video and image datasets can be deployed in Hadoop Distributed File System (HDFS) and processed with Map-reduce algorithm. For NLP, an in-depth explanation of the design and implementation is provided at the end of the chapter.

What you need for this book

We expect all the readers of this book to have some background on computer science. This book mainly talks on different deep neural networks, their designs and applications with Deeplearning4j. To extract the most out of the book, the readers are expected to know the basics of machine learning, linear algebra, probability theory, the concepts of distributed systems and Hadoop. For the implementation of deep neural networks with Hadoop, Deeplearning4j has been extensively used throughout this book. Following is the link for everything you need to run Deeplearning4j:

Who this book is for

If you are a data scientist who wants to learn how to perform deep learning on Hadoop, this is the book for you. Knowledge of the basic machine learning concepts and some understanding of Hadoop is required to make the best use of this book.


In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The .build() function is used to build the layer."

A block of code is set as follows:

public static final String DATA_URL =     

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

MultiLayerNetwork model = new MultiLayerNetwork(getConfiguration());

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "In simple words, any neural network with two or more layers (hidden) is defined as a deep feed-forward network or feed-forward neural network."


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at If you purchased this book elsewhere, you can visit  and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.

  2. Hover the mouse pointer on the SUPPORT tab at the top.

  3. Click on Code Downloads & Errata.

  4. Enter the name of the book in the Search box.

  5. Select the book for which you're looking to download the code files.

  6. Choose from the drop-down menu where you purchased this book from.

  7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows

  • Zipeg / iZip / UnRarX for Mac

  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at We also have other code bundles from our rich catalog of books and videos available at Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to and enter the name of the book in the search field. The required information will appear under the Errata section.


Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.


If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.