Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R deep learning, multiple outputs

Is it possible to create a deep learning net that gives multiple outputs? The reason for doing this is to also try to capture the relationships between outputs. In the examples given I can only create one output.

library(h2o)
localH2O = h2o.init()
irisPath = system.file("extdata", "iris.csv", package = "h2o")
iris.hex = h2o.importFile(localH2O, path = irisPath)
h2o.deeplearning(x = 1:4, y = 5, data = iris.hex, activation = "Tanh", 
             hidden = c(10, 10), epochs = 5)
like image 936
adam.888 Avatar asked Mar 20 '26 09:03

adam.888


1 Answers

It doesn't look like multiple response columns are currently supported in H2O (H2O FAQ and H2O Google Group topic). Their suggestion is to train a new model for each response.

(Nonsensical) example:

library(h2o)
localH2O <- h2o.init()
irisPath <- system.file("extdata", "iris.csv", package = "h2o")
iris.hex <- h2o.importFile(localH2O, path = irisPath)

m1 <- h2o.deeplearning(x = 1:2, y = 3, data = iris.hex, activation = "Tanh", 
         hidden = c(10, 10), epochs = 5, classification = FALSE)
m2 <- h2o.deeplearning(x = 1:2, y = 4, data = iris.hex, activation = "Tanh", 
         hidden = c(10, 10), epochs = 5, classification = FALSE)

However, it appears that multiple responses are available through the deepnet package (check library(sos); findFn("deep learning")).

library(deepnet)
x <- as.matrix(iris[,1:2])
y <- as.matrix(iris[,3:4])
m3 <- dbn.dnn.train(x = x, y = y, hidden = c(5,5))
like image 107
alexforrence Avatar answered Mar 21 '26 23:03

alexforrence



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!