Open your RStudio and follow along !!

Importing libraries

#### Let's import the data set from package MASS
#### Also import h2o package for using h2o
library(MASS)
library(h2o)

Reading the dataset

#### Storing the data set named "Boston" into DataFrame
DataFrame <- Boston
#### To get the Help on Boston dataset uncomment the following code
#### help("Boston")
#### Lets have a look on Structure of Boston data
str(DataFrame)

Data Transformation & H2o initialization

Before we start with deep learning model fitting in R ,we need to do data transformations and h2o initialization.

#### Seems like scale of each variable is not same
### Lets Normalize the data set variables in interval [0,1]
### Normalization is necessary so that each variable is scaled properly
### and none of the variables over dominates in the model
### scale function will give min-max scaling here
### Below is the snippet of code for the same
maxValue <- apply(DataFrame, 2, max)
minValue <- apply(DataFrame, 2, min)
DataFrame<-as.data.frame(scale(DataFrame,center = minValue,
scale = maxValue-minValue))
H2o Initialization
#### Let's do H2o initialization.This will start H2o cluster in local machine
#### There are options for running the same on servers
#### I'm using 2650 Megabytes of RAM out of 8GB RAM.You can choose according to
#### your RAM configuration.
h2o.init(ip = "localhost",port = 54321,max_mem_size = "2650m")

Data Partition & Modelling

Let’s partition the data set into training and testing data set before we start modelling the deep learning model. We need test data to test the accuracy of predictions done by deep learning model in R.So first we will partition the data set ,then we will discuss about deep learning model parameters in H2o in R and then we will finally fit the deep learning model.

analyticsdataexploration.com is your Data Analytics,Machine Learning and Artificial intelligence website. We provide you with the information and tutorials on latest Machine Learning technologies and videos straight from the data analytics industry.