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
€18.99 per month
Paperback Apr 2020 330 pages 1st Edition
eBook
€17.99 €26.99
Paperback
€32.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Pawlus Profile Icon Rodger Devine
Arrow right icon
€18.99 per month
Paperback Apr 2020 330 pages 1st Edition
eBook
€17.99 €26.99
Paperback
€32.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€17.99 €26.99
Paperback
€32.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 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 : 9781788996839
Vendor :
Google
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 : Apr 24, 2020
Length: 330 pages
Edition : 1st
Language : English
ISBN-13 : 9781788996839
Vendor :
Google
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 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

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.