Skip to content

Instantly share code, notes, and snippets.

@woobe
Last active January 7, 2016 15:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save woobe/3e728e02f6cc03ab86d8 to your computer and use it in GitHub Desktop.
Save woobe/3e728e02f6cc03ab86d8 to your computer and use it in GitHub Desktop.
[Blog]: Things to try after useR! Part 1: Regularized Deep Learning with H2O
## Using the DNN model for predictions
h2o_yhat_test <- h2o.predict(model, test_h2o)
## Converting H2O format into data frame
df_yhat_test <- as.data.frame(h2o_yhat_test)
## Start a local cluster with 1GB RAM (default)
library(h2o)
localH2O <- h2o.init(ip = "localhost", port = 54321, startH2O = TRUE)
## Start a local cluster with 2GB RAM
localH2O = h2o.init(ip = "localhost", port = 54321, startH2O = TRUE,
Xmx = '2g')
model <-
h2o.deeplearning(x = 2:785, # column numbers for predictors
y = 1, # column number for label
data = train_h2o, # data in H2O format
activation = "TanhWithDropout", # or 'Tanh'
input_dropout_ratio = 0.2, # % of inputs dropout
hidden_dropout_ratios = c(0.5,0.5,0.5), # % for nodes dropout
balance_classes = TRUE,
hidden = c(50,50,50), # three layers of 50 nodes
epochs = 100) # max. no. of epochs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment