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
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 all three packages at once using Docker

Docker is a software-contained platform that is used to host multiple software or apps side by side in isolated containers to get better computing density. Unlike virtual machines, containers are built only using libraries and the settings required by any software but do not bundle the entire operating system, thus making it lightweight and efficient.

Getting ready

Setting up all three packages could be quite cumbersome depending on the operating system utilized. The following dockerfile code can be used to set up an environment with tensorflow, mxnet with GPU, and h2o installed with all the dependencies:

FROM chstone/mxnet-gpu:latest
MAINTAINER PKS Prakash <prakash5801>


# Install dependencies
RUN apt-get update && apt-get install -y
python2.7
python-pip
python-dev
ipython
ipython-notebook
python-pip
default-jre


# Install pip and Jupyter notebook
RUN pip install --upgrade pip &&
pip install jupyter

# Add R to Jupyter kernel
RUN Rscript -e "install.packages(c('repr', 'IRdisplay', 'crayon', 'pbdZMQ'), dependencies=TRUE, repos='https://cran.rstudio.com')" &&
Rscript -e "library(devtools); library(methods); options(repos=c(CRAN='https://cran.rstudio.com')); devtools::install_github('IRkernel/IRkernel')" &&
Rscript -e "library(IRkernel); IRkernel::installspec(name = 'ir32', displayname = 'R 3.2')"

# Install H2O
RUN Rscript -e "install.packages('h2o', dependencies=TRUE, repos='http://cran.rstudio.com')"

# Install tensorflow fixing the proxy port
RUN pip install tensorflow-gpu
RUN Rscript -e "library(devtools); devtools::install_github('rstudio/tensorflow')"

The current image is created on top of the chstone/mxnet-gpu Docker image.

The chstone/mxnet-gpu is a docker hub repository at https://hub.docker.com/r/chstone/mxnet-gpu/.

How to do it...

Docker will all dependencies can be installed using following steps:

  1. Save the preceding code to a location with a name, say, Dockerfile.
  2. Using the command line, go to the file location and use the following command and it is also shown in the screenshot after the command:
docker run -t "TagName:FILENAME"
Building the docker image
  1. Access the image using the docker images command as follows:
View docker images
  1. Docker images can be executed using the following command:
docker run -it -p 8888:8888 -p 54321:54321 <<IMAGE ID>>
Running a Docker image

Here, the option -i is for interactive mode and -t is to allocate --tty. The option -p is used to forward the port. As we will be running Jupyter on port 8888 and H2O on 54321, we have forwarded both ports to accessible from the local browser.

There's more...

More options for Docker can be checked out using docker run --help.

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