R

用於深度學習的 R 庫

  • November 2, 2012

我想知道是否有任何用於深度學習神經網絡的好的 R 庫?我知道有nnetneuralnetRSNNS,但這些似乎都沒有實現深度學習方法。

我對無監督學習和監督學習以及使用 dropout 防止共同適應特別感興趣。

/edit:幾年後,我發現h20 深度學習包設計得非常好,易於安裝。我也喜歡mxnet 包,它(有點)難以安裝,但支持 covnets 之類的東西,在 GPU 上運行,而且速度非常快。

OpenSource h2o.deepLearning() 是來自 h2o.ai 的 R 深度學習包,這裡有一篇文章http://www.r-bloggers.com/things-to-try-after-user-part-1-deep-learning-與-h2o/

和代碼: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

引用自:https://stats.stackexchange.com/questions/41771

comments powered by Disqus