The previous chapter provided the details for the installation of MXNet in R along with a working example using its web interface. To start modeling, load the MXNet package in the R environment.
- Load the occupancy train and test datasets in R:
# Load the occupancy data occupancy_train <-read.csv("C:/occupation_detection/datatraining.txt",stringsAsFactors = T) occupancy_test <- read.csv("C:/occupation_detection/datatest.txt",stringsAsFactors = T)
- The following independent (
x
) and dependent (y
) variables will be used to model GLM:
# Define input (x) and output (y) variables x = c("Temperature", "Humidity", "Light", "CO2", "HumidityRatio") y = "Occupancy"
- Based on the requirement by MXNet, convert the train and test datasets to a matrix and ensure that the class of the outcome variable is numeric (instead of factor as in the case of H2O):
# convert the train...