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
Java Deep Learning Cookbook
Java Deep Learning Cookbook

Java Deep Learning Cookbook: Train neural networks for classification, NLP, and reinforcement learning using Deeplearning4j

eBook
€8.99 €26.99
Paperback
€32.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Java Deep Learning Cookbook

Data Extraction, Transformation, and Loading

Let's discuss the most important part of any machine learning puzzle: data preprocessing and normalization. Garbage in, garbage out would be the most appropriate statement for this situation. The more noise we let pass through, the more undesirable outputs we will receive. Therefore, you need to remove noise and keep signals at the same time.

Another challenge is handling various types of data. We need to convert raw datasets into a suitable format that a neural network can understand and perform scientific computations on. We need to convert data into a numeric vector so that it is understandable to the network and so that computations can be applied with ease. Remember that neural networks are constrained to only one type of data: vectors.

There has to be an approach regarding how data is loaded into a neural network. We cannot...

Technical requirements

Concrete implementations of the use cases that will be discussed in this chapter can be found at https://github.com/PacktPublishing/Java-Deep-Learning-Cookbook/tree/master/02_Data_Extraction_Transform_and_Loading/sourceCode/cookbook-app/src/main/java/com/javadeeplearningcookbook/app.

After cloning our GitHub repository, navigate to the
Java-Deep-Learning-Cookbook/02_Data_Extraction_Transform_and_Loading/sourceCode directory. Then, import the cookbook-app project as a Maven project by importing the pom.xml file inside the cookbook-app directory.

The datasets that are required for this chapter are located in the Chapter02 root directory (Java-Deep-Learning-Cookbook/02_Data_Extraction_Transform_and_Loading/). You may keep it in a different location, for example, your local directory, and then refer to it in the source code accordingly.

...

Reading and iterating through data

ETL is an important stage in neural network training since it involves data. Data extraction, transformation, and loading needs to be addressed before we proceed with neural network design. Bad data is a much worse situation than a less efficient neural network. We need to have a basic understanding of the following aspects as well:

  • The type of data you are trying to process
  • File-handling strategies

In this recipe, we will demonstrate how to read and iterate data using DataVec.

Getting ready

As a prerequisite, make sure that the required Maven dependencies have been added for DataVec in your pom.xml file, as we mentioned in previous chapter, Configuring Maven for DL4J recipe.

The following...

Performing schema transformations

Data transformation is an important data normalization process. It's a possibility that bad data occurs, such as duplicates, missing values, non-numeric features, and so on. We need to normalize them by applying schema transformation so that data can be processed in a neural network. A neural network can only process numeric features. In this recipe, we will demonstrate the schema creation process.

How to do it...

  1. Identify the outliers in the data: For a small dataset with just a few features, we can spot outliers/noise via manual inspection. For a dataset with a large number of features, we can perform Principal Component Analysis (PCA), as shown in the following code:
INDArray factor...

Building a transformation process

The next step after schema creation is to define a data transformation process by adding all the required transformations. We can manage an ordered list of transformations using TransformProcess. During the schema creation process, we only defined a structure for the data with all its existing features and didn't really perform transformation. Let's look at how we can transform the features in the datasets from a non-numeric format into a numeric format. Neural networks cannot understand raw data unless it is mapped to numeric vectors. In this recipe, we will build a transformation process from the given schema.

How to do it...

  1. Add a list of transformations to TransformProcess....

Serializing transforms

DataVec gives us the ability to serialize the transforms so that they're portable for production environments. In this recipe, we will serialize the transformation process.

How to do it...

  1. Serialize the transforms into a human-readable format. We can transform to JSON using TransformProcess as follows:
String serializedTransformString = transformProcess.toJson()

We can transform to YAML using TransformProcess as follows:

String serializedTransformString = transformProcess.toYaml()

Executing a transform process

After the transformation process has been defined, we can execute it in a controlled pipeline. It can be executed using batch processing, or we can distribute the effort to a Spark cluster. Previously, we look at TransformProcessRecordReader, which automatically does the transformation in the background. We cannot feed and execute the data if the dataset is huge. Effort can be distributed to a Spark cluster for a larger dataset. You can also perform regular local execution. In this recipe, we will discuss how to execute a transform process locally as well as remotely.

How to do it...

  1. Load the dataset into RecordReader. Load the CSV data in the case of CSVRecordReader:
RecordReader reader = new...

Normalizing data for network efficiency

Normalization makes a neural network's job much easier. It helps the neural network treat all the features the same, irrespective of their range of values. The main goal of normalization is to arrange the numeric values in a dataset on a common scale without actually disturbing the difference in the range of values. Not all datasets require a normalization strategy, but if they do have different numeric ranges, then it is a crucial step to perform normalization on the data. Normalization has a direct impact on the stability/accuracy of the model. ND4J has various preprocessors to handle normalization. In this recipe, we will normalize the data.

How to do it...

  1. Create a dataset...
Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Install and configure Deeplearning4j to implement deep learning models from scratch
  • Explore recipes for developing, training, and fine-tuning your neural network models in Java
  • Model neural networks using datasets containing images, text, and time-series data

Description

Java is one of the most widely used programming languages in the world. With this book, you will see how to perform deep learning using Deeplearning4j (DL4J) – the most popular Java library for training neural networks efficiently. This book starts by showing you how to install and configure Java and DL4J on your system. You will then gain insights into deep learning basics and use your knowledge to create a deep neural network for binary classification from scratch. As you progress, you will discover how to build a convolutional neural network (CNN) in DL4J, and understand how to construct numeric vectors from text. This deep learning book will also guide you through performing anomaly detection on unsupervised data and help you set up neural networks in distributed systems effectively. In addition to this, you will learn how to import models from Keras and change the configuration in a pre-trained DL4J model. Finally, you will explore benchmarking in DL4J and optimize neural networks for optimal results. By the end of this book, you will have a clear understanding of how you can use DL4J to build robust deep learning applications in Java.

Who is this book for?

If you are a data scientist, machine learning developer, or a deep learning enthusiast who wants to implement deep learning models in Java, this book is for you. Basic understanding of Java programming as well as some experience with machine learning and neural networks is required to get the most out of this book.

What you will learn

  • Perform data normalization and wrangling using DL4J
  • Build deep neural networks using DL4J
  • Implement CNNs to solve image classification problems
  • Train autoencoders to solve anomaly detection problems using DL4J
  • Perform benchmarking and optimization to improve your model s performance
  • Implement reinforcement learning for real-world use cases using RL4J
  • Leverage the capabilities of DL4J in distributed systems

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Nov 08, 2019
Length: 304 pages
Edition : 1st
Language : English
ISBN-13 : 9781788999472
Vendor :
Oracle
Category :
Languages :
Concepts :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Nov 08, 2019
Length: 304 pages
Edition : 1st
Language : English
ISBN-13 : 9781788999472
Vendor :
Oracle
Category :
Languages :
Concepts :

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 119.97
Java Deep Learning Cookbook
€32.99
Java Coding Problems
€41.99
Hands-On Microservices with Spring Boot and Spring Cloud
€44.99
Total 119.97 Stars icon
Banner background image

Table of Contents

13 Chapters
Introduction to Deep Learning in Java Chevron down icon Chevron up icon
Data Extraction, Transformation, and Loading Chevron down icon Chevron up icon
Building Deep Neural Networks for Binary Classification Chevron down icon Chevron up icon
Building Convolutional Neural Networks Chevron down icon Chevron up icon
Implementing Natural Language Processing Chevron down icon Chevron up icon
Constructing an LSTM Network for Time Series Chevron down icon Chevron up icon
Constructing an LSTM Neural Network for Sequence Classification Chevron down icon Chevron up icon
Performing Anomaly Detection on Unsupervised Data Chevron down icon Chevron up icon
Using RL4J for Reinforcement Learning Chevron down icon Chevron up icon
Developing Applications in a Distributed Environment Chevron down icon Chevron up icon
Applying Transfer Learning to Network Models Chevron down icon Chevron up icon
Benchmarking and Neural Network Optimization Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5
(2 Ratings)
5 star 50%
4 star 50%
3 star 0%
2 star 0%
1 star 0%
Maxwell Dec 16, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is an excellently put together book on deep learning. The author puts you on a path to truly understanding how to use java to build learning applications. Granted, you will need the skills to back it up, but if you're like me and just needed a bit of help to get you started -- then this is book is an excellent choice.I liked how well this book flowed as well. Seeing a huge wall of text can be be off-putting when trying to learn something complex like this. I can confidently say I came away with more knowledge than I had when I started. So for me, it was worth the purchase.
Amazon Verified review Amazon
Cliente Amazon Mar 23, 2020
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Thee book is awesome if you don't have knowledge about DL4J. It explains quite well how the basic of algorithms for Machine Learning work. I found really good examples, but incompletes in some way. My humble opinion: it's a good choice if you don't have prior knowledge in DL4J.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.