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
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
R Deep Learning Cookbook

You're reading from   R Deep Learning Cookbook Solve complex neural net problems with TensorFlow, H2O and MXNet

Arrow left icon
Product type Paperback
Published in Aug 2017
Publisher Packt
ISBN-13 9781787121089
Length 288 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Achyutuni Sri Krishna Rao Achyutuni Sri Krishna Rao
Author Profile Icon Achyutuni Sri Krishna Rao
Achyutuni Sri Krishna Rao
PKS Prakash PKS Prakash
Author Profile Icon PKS Prakash
PKS Prakash
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Getting Started FREE CHAPTER 2. Deep Learning with R 3. Convolution Neural Network 4. Data Representation Using Autoencoders 5. Generative Models in Deep Learning 6. Recurrent Neural Networks 7. Reinforcement Learning 8. Application of Deep Learning in Text Mining 9. Application of Deep Learning to Signal processing 10. Transfer Learning

Installing MXNet in R

This section will cover the installation of MXNet in R.

Getting ready

The MXNet package is a lightweight deep learning architecture supporting multiple programming languages such as R, Python, and Julia. From a programming perspective, it is a combination of symbolic and imperative programming with support for CPU and GPU.

The CPU-based MXNet in R can be installed using the prebuilt binary package or the source code where the libraries need to be built. In Windows/mac, prebuilt binary packages can be download and installed directly from the R console. MXNet requires the R version to be 3.2.0 and higher. The installation requires the drat package from CRAN. The drat package helps maintain R repositories and can be installed using the install.packages() command.

To install MXNet on Linux (13.10 or later), the following are some dependencies:

  • Git (to get the code from GitHub)
  • libatlas-base-dev (to perform linear algebraic operations)
  • libopencv-dev (to perform computer vision operations)

To install MXNet with a GPU processor, the following are some dependencies:

  • Microsoft Visual Studio 2013
  • The NVIDIA CUDA Toolkit
  • The MXNet package
  • cuDNN (to provide a deep neural network library)

Another quick way to install mxnet with all the dependencies is to use the prebuilt Docker image from the chstone repository. The chstone/mxnet-gpu Docker image will be installed using the following tools:

  • MXNet for R and Python
  • Ubuntu 16.04
  • CUDA (Optional for GPU)
  • cuDNN (Optional for GPU)

How to do it...

  1. The following R command installs MXNet using prebuilt binary packages, and is hassle-free. The drat package is then used to add the dlmc repository from git followed by the mxnet installation:
install.packages("drat", repos="https://cran.rstudio.com")
drat:::addRepo("dmlc")
install.packages("mxnet")

2. The following code helps install MXNet in Ubuntu (V16.04). The first two lines are used to install dependencies and the remaining lines are used to install MXNet, subject to the satisfaction of all the dependencies:

sudo apt-get update
sudo apt-get install -y build-essential git libatlas-base-dev
libopencv-dev
git clone https://github.com/dmlc/mxnet.git ~/mxnet --recursive
cd ~/mxnet
cp make/config.mk .
echo "USE_BLAS=openblas" >>config.mk
make -j$(nproc)

3. If MXNet is to be built for GPU, the following config needs to be updated before the make command:

echo "USE_CUDA=1" >>config.mk
echo "USE_CUDA_PATH=/usr/local/cuda" >>config.mk
echo "USE_CUDNN=1" >>config.mk
A detailed installation of MXNet for other operating systems can be found at http://mxnet.io/get_started/setup.html.

4. The following command is used to install MXNet (GPU-based) using Docker with all the dependencies:

docker pull chstone/mxnet-gpu
You have been reading a chapter from
R Deep Learning Cookbook
Published in: Aug 2017
Publisher: Packt
ISBN-13: 9781787121089
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image