Train Deep Learning Model with R Studio in AWS EC2

AWS provides us with approachable GPU based cloud computing capability with minimal cost.

We will talk about the steps to take advantage of AWS EC2 to build GPU computing for our model training in R.

1.  Register AWS account…

2. Find EC2 service

Screen Shot 2017-04-27 at 9.13.18 PM.png

3. Click “launch instance” and go for this one labeled Free tier eligible and HVM:

Screen Shot 2017-04-27 at 9.14.48 PM.png

4. check the default option and go for “Configure Instance Details”

Screen Shot 2017-04-27 at 9.15.51 PM.png

5. Next page, in advanced details, input the following text:Screen Shot 2017-04-27 at 9.17.40 PM.png

#!/bin/bash
#install R
yum install -y R
#install RStudio-Server
wget https://download2.rstudio.org/rstudio-server-rhel-0.99.465-x86_64.rpm
yum install -y --nogpgcheck rstudio-server-rhel-0.99.465-x86_64.rpm
#install shiny and shiny-server
R -e "install.packages('shiny', repos='http://cran.rstudio.com/')"
wget https://download3.rstudio.org/centos5.9/x86_64/shiny-server-1.4.0.718-rh5-x86_64.rpm
yum install -y --nogpgcheck shiny-server-1.4.0.718-rh5-x86_64.rpm
#add user(s)
useradd username
echo username:password | chpasswd

0.99.465 is the version of R studio, pls find the latest one to replace it.
change the username and password to your desired name and pw.

6. click “review and launch”, go to “Security Groups”. Add Rule and edit as following:

Screen Shot 2017-04-27 at 9.29.52 PM.png

7. Review and Launch and click  “launch”, and on the popped up window select create a new key pair. Name the pair and download it and save it.Screen Shot 2017-04-27 at 9.23.40 PM.png

7. Click” launch instances” and go to instance view page.

Screen Shot 2017-04-27 at 9.05.51 PM.png8. When all the lights are green as shown above, select your instance and click “Connect” above. You can see another window here.

Screen Shot 2017-04-27 at 9.26.44 PM.png Copy the DNS of NO.4 of “To access your instance” and paste into your browser, add “:8787” at the end of the DNS address.

9. You will see the log in page of R server. Use the user name and password set already to log in and you can see the familiar r studio.Screen Shot 2017-04-27 at 9.34.34 PM.png

10. install h2o package and we can train our deep learning model.

Screen Shot 2017-04-27 at 9.04.50 PM.png

11. About the data to load.

There are two ways to load data for R studio running in instance of AWS EC2.

We can upload the data through the window at the right bottom in .zip(recommended).

Or we can use S3 service or AWS can store the data online and use the data with RCurl package with url.

Screen Shot 2017-04-27 at 9.04.56 PM.png

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s