adam.888
adam.888

Reputation: 7846

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)

Upvotes: 3

Views: 2717

Answers (1)

alexforrence
alexforrence

Reputation: 2744

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))

Upvotes: 2

Related Questions