Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Hands-On Deep Learning with R
Hands-On Deep Learning with R

Hands-On Deep Learning with R: A practical guide to designing, building, and improving neural network models using R

Arrow left icon
Profile Icon Pawlus Profile Icon Rodger Devine
Arrow right icon
£26.99
eBook Apr 2020 330 pages 1st Edition
eBook
£26.99
Paperback
£32.99
Subscription
Free Trial
Renews at £16.99p/m
Arrow left icon
Profile Icon Pawlus Profile Icon Rodger Devine
Arrow right icon
£26.99
eBook Apr 2020 330 pages 1st Edition
eBook
£26.99
Paperback
£32.99
Subscription
Free Trial
Renews at £16.99p/m
eBook
£26.99
Paperback
£32.99
Subscription
Free Trial
Renews at £16.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
Table of content icon View table of contents Preview book icon Preview Book

Hands-On Deep Learning with R

Machine Learning Basics

Welcome to Hands-On Deep Learning with R! This book will take you through all of the steps that are necessary to code deep learning models using the R statistical programming language. It begins with simple examples as the first step for those just getting started, along with a review of the foundational elements of deep learning for those with more experience. As you progress through this book, you will learn how to code increasingly complex deep learning solutions for a wide variety of tasks. However, regardless of the complexity, each chapter will carefully detail each step. This is so that all topics and concepts can be fully comprehended and the reason for every line of code is completely explained.

In this chapter, we will go through a quick overview of the machine learning process as it will form a base for the subsequent chapters of this book.&...

An overview of machine learning

All deep learning is machine learning, but not all machine learning is deep learning. Throughout this book, we will focus on processes and techniques that are specific to deep learning in R. However, all the core principles of machine learning are essential to understand before we can move on to explore deep learning.

Deep learning is marked as a special subset of machine learning based on the use of neural networks that mimic brain activity behavior. The learning is referred to as being deep because, during the modeling process, the data is manipulated by a number of hidden layers. In this type of modeling, specific information is gathered from each layer. For example, one layer may find the edges of images while another finds particular hues.

Notable applications for this type of machine learning include the following:

  • Image recognition...

Preparing data for modeling

One of the benefits of deep learning is that it largely removes the need for feature engineering, which you may be used to with machine learning. That being said, the data still needs to be prepared before we begin modeling. Let's review the following goals to prepare data for modeling:

  • Remove no-information and extremely low-information variables
  • Identify dates and extract date parts
  • Handle missing values
  • Handle outliers

In this chapter, we will be investigating air quality data using data provided by the London Air Quality Network. Specifically, we will look at readings for nitrogen dioxide in the area of Tower Hamlets (Mile End Road) during 2018. This is a very small dataset with only a few features and approximately 35,000 observations. We are using a limited dataset here so that all of our code, even our modeling, runs quickly. That said...

Training a model on prepared data

Now that the data is ready, we will split it into train and test sets and run a simple model. The objective at this point is not to try to achieve the best performance, but rather to get some type of a benchmark result to use in the future as we try to improve our model.

Train and test data

When we build predictive models, we need to create two separate sets of data with the help of the following segments. One is used by the model to learn the task and the other is used to test how well the model learned the task. Here are the types of data that we will look at:

  • Train data: The segment of the data used to fit the model. The model has access to the explainer variables or independent variables...

Evaluating model results

We only know whether a model is successful if we can measure it, and it is worthwhile taking a moment to remember which metrics to use in which scenarios. Take, for example, a credit card fraud dataset where there is a large imbalance in the target variable because there will only be a, relatively, few cases of fraud among many non-fraudulent cases.

If we use a metric that just measures the percentage of the target variable that we predict successfully, then we will not be evaluating our model in a very helpful way. In this case, to keep the math simple, let's imagine we have 10,000 cases and only 10 of them are fraudulent accounts. If we predict that all cases are not fraudulent, then we will have 99.9% accuracy. This is very accurate, but it is not very helpful. Here is a review of the different metrics and when to use them.

...

Improving model results

Since we have a regression problem, we now know why we chose RMSE, and we have a baseline metric of performance, we can begin to work on improving our model. Every model will have its own different way of improving results; however, we can generalize slightly. Feature engineering helps to improve model performance; however, since this type of work is less important with deep learning, we will not focus on that here. Also, we have already used feature engineering to generate our date and time parts. In addition, we can run our model for longer at a slower learning rate and we can tune hyperparameters. In order to find the best values using this type of model improvement method, we will use a technique called grid search to look at a range of values for a number of different fields.

Let's search for the optimal number of rounds. Using the cross-validation...

Reviewing different algorithms

We have raced through machine learning relatively quickly, as we wanted to focus on the underlying concepts that will follow along with us as we head into deep learning. As such, we cannot offer a comprehensive explanation of all machine learning techniques; however, we will quickly review the different algorithm types here, as this will be helpful to remember going forward.

We'll do a quick review of the following machine learning algorithms:

  • Decision Trees: A decision tree is a simple model that makes up the base learners of many more complex algorithms. A decision tree simply splits a dataset at a given variable and notes the proportion of the target class that exists in the splits. For example, if we were to predict who is more likely to enjoy playing with baby toys, then a split on age would likely show that the split of the data...

Summary

In this chapter, we referred to a raw dataset, explored the data, and took the necessary preprocessing steps to get the data ready for modeling. We performed data type transformations to convert numbers and dates being stored as character strings into numeric and date value columns, respectively. In addition, we performed some feature engineering by breaking up the date value into its component parts. After completing preprocessing, we modeled our data. We followed an approach that included creating a baseline model and then tuning hyperparameters to improve our initial score. We used early stopping rounds and grid searches to identify hyperparameter values that produced the best results. After modifying our model-based results from our tuning procedures, we noticed much better performance.

All of the aspects of machine learning that were discussed in this chapter will...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Understand deep learning algorithms and architectures using R and determine which algorithm is best suited for a specific problem
  • Improve models using parameter tuning, feature engineering, and ensembling
  • Apply advanced neural network models such as deep autoencoders and generative adversarial networks (GANs) across different domains

Description

Deep learning enables efficient and accurate learning from a massive amount of data. This book will help you overcome a number of challenges using various deep learning algorithms and architectures with R programming. This book starts with a brief overview of machine learning and deep learning and how to build your first neural network. You’ll understand the architecture of various deep learning algorithms and their applicable fields, learn how to build deep learning models, optimize hyperparameters, and evaluate model performance. Various deep learning applications in image processing, natural language processing (NLP), recommendation systems, and predictive analytics will also be covered. Later chapters will show you how to tackle recognition problems such as image recognition and signal detection, programmatically summarize documents, conduct topic modeling, and forecast stock market prices. Toward the end of the book, you will learn the common applications of GANs and how to build a face generation model using them. Finally, you’ll get to grips with using reinforcement learning and deep reinforcement learning to solve various real-world problems. By the end of this deep learning book, you will be able to build and deploy your own deep learning applications using appropriate frameworks and algorithms.

Who is this book for?

This book is for data scientists, machine learning engineers, and deep learning developers who are familiar with machine learning and are looking to enhance their knowledge of deep learning using practical examples. Anyone interested in increasing the efficiency of their machine learning applications and exploring various options in R will also find this book useful. Basic knowledge of machine learning techniques and working knowledge of the R programming language is expected.

What you will learn

  • Design a feedforward neural network to see how the activation function computes an output
  • Create an image recognition model using convolutional neural networks (CNNs)
  • Prepare data, decide hidden layers and neurons and train your model with the backpropagation algorithm
  • Apply text cleaning techniques to remove uninformative text using NLP
  • Build, train, and evaluate a GAN model for face generation
  • Understand the concept and implementation of reinforcement learning in R

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Apr 24, 2020
Length: 330 pages
Edition : 1st
Language : English
ISBN-13 : 9781788993784
Vendor :
Google
Category :
Languages :
Concepts :
Tools :

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

Product Details

Publication date : Apr 24, 2020
Length: 330 pages
Edition : 1st
Language : English
ISBN-13 : 9781788993784
Vendor :
Google
Category :
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
£16.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
£169.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
£234.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 £ 102.97
Hands-On Deep Learning with R
£32.99
Advanced Deep Learning with TensorFlow 2 and Keras
£32.99
Deep Learning with R Cookbook
£36.99
Total £ 102.97 Stars icon

Table of Contents

15 Chapters
Section 1: Deep Learning Basics Chevron down icon Chevron up icon
Machine Learning Basics Chevron down icon Chevron up icon
Setting Up R for Deep Learning Chevron down icon Chevron up icon
Artificial Neural Networks Chevron down icon Chevron up icon
Section 2: Deep Learning Applications Chevron down icon Chevron up icon
CNNs for Image Recognition Chevron down icon Chevron up icon
Multilayer Perceptron for Signal Detection Chevron down icon Chevron up icon
Neural Collaborative Filtering Using Embeddings Chevron down icon Chevron up icon
Deep Learning for Natural Language Processing Chevron down icon Chevron up icon
Long Short-Term Memory Networks for Stock Forecasting Chevron down icon Chevron up icon
Generative Adversarial Networks for Faces Chevron down icon Chevron up icon
Section 3: Reinforcement Learning Chevron down icon Chevron up icon
Reinforcement Learning for Gaming Chevron down icon Chevron up icon
Deep Q-Learning for Maze Solving Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
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.