Last active
February 1, 2017 15:04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#load the package | |
require(h2o) | |
#start h2o | |
localH2o <- h2o.init(nthreads = -1, max_mem_size = "20G") | |
#load data on H2o | |
trainh2o <- as.h2o(train) | |
testh2o <- as.h2o(test) | |
#set variables | |
y <- "target" | |
x <- setdiff(colnames(trainh2o),y) | |
#train the model - without hidden layer | |
deepmodel <- h2o.deeplearning(x = x | |
,y = y | |
,training_frame = trainh2o | |
,standardize = T | |
,model_id = "deep_model" | |
,activation = "Rectifier" | |
,epochs = 100 | |
,seed = 1 | |
,nfolds = 5 | |
,variable_importances = T) | |
#compute variable importance and performance | |
h2o.varimp_plot(deepmodel,num_of_features = 20) | |
h2o.performance(deepmodel,xval = T) #84.5 % CV accuracy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment