Deep Learning with R Cookbook
eBook - ePub

Deep Learning with R Cookbook

Over 45 unique recipes to delve into neural network techniques using R 3.5.x

  1. 328 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Deep Learning with R Cookbook

Over 45 unique recipes to delve into neural network techniques using R 3.5.x

About this book

Tackle the complex challenges faced while building end-to-end deep learning models using modern R libraries

Key Features

  • Understand the intricacies of R deep learning packages to perform a range of deep learning tasks
  • Implement deep learning techniques and algorithms for real-world use cases
  • Explore various state-of-the-art techniques for fine-tuning neural network models

Book Description

Deep learning (DL) has evolved in recent years with developments such as generative adversarial networks (GANs), variational autoencoders (VAEs), and deep reinforcement learning. This book will get you up and running with R 3.5.x to help you implement DL techniques.

The book starts with the various DL techniques that you can implement in your apps. A unique set of recipes will help you solve binomial and multinomial classification problems, and perform regression and hyperparameter optimization. To help you gain hands-on experience of concepts, the book features recipes for implementing convolutional neural networks (CNNs), recurrent neural networks (RNNs), and Long short-term memory (LSTMs) networks, as well as sequence-to-sequence models and reinforcement learning. You'll then learn about high-performance computation using GPUs, along with learning about parallel computation capabilities in R. Later, you'll explore libraries, such as MXNet, that are designed for GPU computing and state-of-the-art DL. Finally, you'll discover how to solve different problems in NLP, object detection, and action identification, before understanding how to use pre-trained models in DL apps.

By the end of this book, you'll have comprehensive knowledge of DL and DL packages, and be able to develop effective solutions for different DL problems.

What you will learn

  • Work with different datasets for image classification using CNNs
  • Apply transfer learning to solve complex computer vision problems
  • Use RNNs and their variants such as LSTMs and Gated Recurrent Units (GRUs) for sequence data generation and classification
  • Implement autoencoders for DL tasks such as dimensionality reduction, denoising, and image colorization
  • Build deep generative models to create photorealistic images using GANs and VAEs
  • Use MXNet to accelerate the training of DL models through distributed computing

Who this book is for

This deep learning book is for data scientists, machine learning practitioners, deep learning researchers and AI enthusiasts who want to learn key tasks in deep learning domains using a recipe-based approach. A strong understanding of machine learning and working knowledge of the R programming language is mandatory.

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Deep Learning with R Cookbook by Swarna Gupta,Rehan Ali Ansari,Dipayan Sarkar in PDF and/or ePUB format, as well as other popular books in Computer Science & Computer Science General. We have over one million books available in our catalogue for you to explore.

Information

Understanding Neural Networks and Deep Neural Networks

Deep learning has transformed many traditional businesses, such as web search, advertising, and many more. A major challenge with the traditional machine learning approaches is that we need to spend a considerable amount of time choosing the most appropriate feature selection process before modeling. Besides this, these traditional techniques operate with some level of human intervention and guidance. However, with deep learning algorithms, we can get rid of the overhead of explicit feature selection since it is taken care of by the models themselves. These deep learning algorithms are capable of modeling complex and non-linear relationships within the data. In this book, we'll introduce you to how to set up a deep learning ecosystem in R. Deep neural networks use sophisticated mathematical modeling techniques to process data in complex ways. In this book, we'll showcase the use of various deep learning libraries, such as keras and MXNet, so that you can utilize their enriched set of functions and capabilities in order to build and execute deep learning models, although we'll primarily focus on working with the keras library. These libraries come with CPU and GPU support and are user-friendly so that you can prototype deep learning models quickly.
In this chapter, we will demonstrate how to set up a deep learning environment in R. You will also get familiar with various TensorFlow APIs and how to implement a neural network using them. You will also learn how to tune the various parameters of a neural network and also gain an understanding of various activation functions and their usage for different types of problem statements.
In this chapter, we will cover the following recipes:
  • Setting up the environment
  • Implementing neural networks with Keras
  • TensorFlow Estimator API
  • TensorFlow Core API
  • Implementing a single-layer neural network
  • Training your first deep neural network

Setting up the environment

Before implementing a deep neural network, we need to set up our system and configure it so that we can apply a variety of deep learning techniques. This recipe assumes that you have the Anaconda distribution installed on your system.

Getting ready

Let's configure our system for deep learning. It is recommended that you create a deep learning environment in Anaconda. If you have an older version of R in the conda environment, you need to update your R version to 3.5.x or above.
You also need to install the CUDA and cuDNN libraries for GPU support. You can read more about the prerequisites at https://tensorflow.rstudio.com/tools/local_gpu.html#prerequisties.
Please note that if your system does not have NVIDIA graphics support, then GPU processing cannot be done.

How to do it...

Let's create an environment in Anaconda (ensure that you have R and Python installed):
  1. Go to Anaconda Navigator from the Start menu.
  2. Click on Environments.
  3. Create a new environment and name it. Make sure that both the Python and R options are selected, as shown in the following screenshot:
  1. Install the keras library in R using the following command in RStudio or by using the Terminal of the conda environment created in the previous step:
install.packages("keras")
  1. Install keras with the tensorflow backend.
The keras library supports TensorFlow as the default backend. Theano and CNTK are other alternative backends that can be used instead of TensorFlow.

To install the CPU version, please refer to the following code:
install_keras(method = c("auto", "virtualenv", "conda"), conda = "auto", version = "default", tensorflow = "default", extra_packages = c("tensorflow-hub"))
For more details about this function, please go to https://keras.rstudio.com/reference/install_keras.html.
To install the GPU version, please refer to the following steps:
  1. Ensure that you have met all the installation prerequisites, including installing the CUDA and cuDNN libraries.
  2. Set the tensorflow argument's value to gpu in the install_keras() function:
install_keras(tensorflow = "gpu")
The preceding command will install the GPU version of keras in R.

How it works...

Keras and TensorFlow programs can be executed on both CPUs and GPUs, though these programs usually run faster on GPUs. If your system does not support an NVIDIA GPU, you only need to install the CPU version. However, if your system has an NVIDIA GPU that meets all the prerequisites and you need to run performance-critical applications, you should install the GPU version. To run the GPU version of TensorFlow, we need an NVIDIA GPU, and then we need to install a variety of software components (CUDA Toolkit v9.0, NVIDIA drivers, and cuDNN v7.0) on the system.
In steps 1 to 3, we created a new conda environment with both the R and Python kernels installed. In steps 4 and 5, we installed the keras library in the environment we created.

There's more...

The only supported installation method on Windows is conda. Therefore, you should install Anaconda 3.x for Windows before installing keras. The keras package uses the TensorFlow backend by default. If you want to switch to Theano or CNTK, call the use_backend() function after loading the keras l...

Table of contents

  1. Title Page
  2. Copyright and Credits
  3. Dedication
  4. About Packt
  5. Foreword
  6. Contributors
  7. Preface
  8. Understanding Neural Networks and Deep Neural Networks
  9. Working with Convolutional Neural Networks
  10. Recurrent Neural Networks in Action
  11. Implementing Autoencoders with Keras
  12. Deep Generative Models
  13. Handling Big Data Using Large-Scale Deep Learning
  14. Working with Text and Audio for NLP
  15. Deep Learning for Computer Vision
  16. Implementing Reinforcement Learning
  17. Other Books You May Enjoy