Solved – R libraries for deep learning

deep learningdeep-belief-networksneural networksrrestricted-boltzmann-machine

I was wondering if there's any good R libraries out there for deep learning neural networks? I know there's the nnet, neuralnet, and RSNNS, but none of these seem to implement deep learning methods.

I'm especially interested in unsupervised followed by supervised learning, and using dropout to prevent co-adaptation.

/edit: After a few years, I've found the h20 deep learning package very well-designed and easy to install. I also love the mxnet package, which is (a little) harder to install but supports things like covnets, runs on GPUs, and is really fast.

Best Answer

OpenSource h2o.deepLearning() is package for deeplearning in R from h2o.ai here's a write up http://www.r-bloggers.com/things-to-try-after-user-part-1-deep-learning-with-h2o/

And code: https://gist.github.com/woobe/3e728e02f6cc03ab86d8#file-link_data-r

######## *Convert Breast Cancer data into H2O*
dat <- BreastCancer[, -1]  # remove the ID column
dat_h2o <- as.h2o(localH2O, dat, key = 'dat')

######## *Import MNIST CSV as H2O*
dat_h2o <- h2o.importFile(localH2O, path = ".../mnist_train.csv")

######## *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 2GB RAM
library(h2o)
localH2O = h2o.init(ip = "localhost", port = 54321, startH2O = TRUE, 
                    Xmx = '2g') 
########Execute deeplearning

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