Session Ready
Exercise

Random search with h2o

Next, you will use random search. The h2o library and seeds_train_data have already been loaded for you and the following code has been run:

h2o.init()
seeds_train_data_hf <- as.h2o(seeds_train_data)

y <- "seed_type"
x <- setdiff(colnames(seeds_train_data_hf), y)

seeds_train_data_hf[, y] <- as.factor(seeds_train_data_hf[, y])

sframe <- h2o.splitFrame(seeds_train_data_hf, seed = 42)
train <- sframe[[1]]
valid <- sframe[[2]]

dl_params <- list(hidden = list(c(50, 50), c(100, 100)),
                  epochs = c(5, 10, 15),
                  rate = c(0.001, 0.005, 0.01))
Instructions
100 XP
  • Define a search criteria object that defines random search with a maximum runtime of 10 seconds.
  • Add this search criteria object at the appropriate place in the h2o.grid function to train the random models.