Deep Learning-Beginners Guide using R and H2O
This is a very basic tutorial on Deep Learning using R and H2O. I am going to use the H2O package for R. Please follow this link for all the installation options or you can just install package using this simple line of code.
install.packages("h2o")
If you are using R Studio you will get option to install package under Packages tab.
I am going to use the Car Evaluation data set for this tutorial.The model evaluates cars according to the following concept structure:
Data Set Information
CAR car acceptability
. PRICE overall price
. . buying buying price
. . maint price of the maintenance
. TECH technical characteristics
. . COMFORT comfort
. . . doors number of doors
. . . persons capacity in terms of persons to carry
. . . lug_boot the size of luggage boot
. . safety estimated safety of the car
Attribute Information
Class Values:
unacc, acc, good, vgood
Attributes:
buying: vhigh, high, med, low.
maint: vhigh, high, med, low.
doors: 2, 3, 4, 5more.
persons: 2, 4, more.
lug_boot: small, med, big.
safety: low, med, high.
all right, fasten your seat belts, I am going to start the journey.
Using R Studio I have created a new R script with the following code.
library(h2o) localH2O = h2o.init(ip = "localhost", port = 54321, startH2O = TRUE)
This block of code will load H2O package and will initialize H2O. If everything goes fine you are going to see the following message in the console.
Now you will be able use H2O flow in your browser with the following url http://localhost:54321/
The “Assistance” will help you to get started. Use the Import Files option to import your data set in H2O Flow.
Click on Parse these files to parse your data set and you will get the option to set up the parsing option.
I am going to change the data type for column 3 and 4 from Numeric to String as in our data set Column 3 and 4 represents these following attributes and they contain string value.
doors: 2, 3, 4, 5more.
persons: 2, 4, more.
so after necessary modification the setup will look like the following:
click on view to see the frame view.
click on Split to split your frame into 75% training data set and 25% test data set(this is the default).
now it’s time to build the model and to do that click on build model. Select the algorithm as Deep Learning. You will find lots of parameters to select for building the model. For this example, I have used the following:
training_frame=>frame_0.750
validation_frame=>frame_0.250
response_column=>class
For the rest I kept the default values and clicked on Build.
To see the results click on view. I am presenting some of the outcomes over here.
For further research, you can follow these links below:
http://h2o-release.s3.amazonaws.com/h2o/rel-lambert/5/docs-website/Ruser/Rinstall.html
http://h2o-release.s3.amazonaws.com/h2o/rel-kahan/2/docs-website/tutorial/rtutorial.html
http://blog.h2o.ai/2013/08/run-h2o-from-within-r/
http://www.r-bloggers.com/diving-into-h2o/
http://learn.h2o.ai/content/tutorials/deeplearning/
http://rpackages.ianhowson.com/cran/h2o/man/h2o.deeplearning.html