Extract the non-linear feature from an H2O data set using an H2O deep learning model.

h2o.deepfeatures(object, data, layer)

Arguments

object

An H2OModel object that represents the deep learning model to be used for feature extraction.

data

An H2OFrame object.

layer

Index (for DeepLearning, integer) or Name (for DeepWater, String) of the hidden layer to extract

Value

Returns an H2OFrame object with as many features as the number of units in the hidden layer of the specified index.

See also

h2o.deeplearning for making H2O Deep Learning models.

h2o.deepwater for making H2O DeepWater models.

Examples

# NOT RUN {
library(h2o)
h2o.init()
prosPath = system.file("extdata", "prostate.csv", package = "h2o")
prostate.hex = h2o.importFile(path = prosPath)
prostate.dl = h2o.deeplearning(x = 3:9, y = 2, training_frame = prostate.hex,
                               hidden = c(100, 200), epochs = 5)
prostate.deepfeatures_layer1 = h2o.deepfeatures(prostate.dl, prostate.hex, layer = 1)
prostate.deepfeatures_layer2 = h2o.deepfeatures(prostate.dl, prostate.hex, layer = 2)
head(prostate.deepfeatures_layer1)
head(prostate.deepfeatures_layer2)

#if (h2o.deepwater.available()) {
#  prostate.dl = h2o.deepwater(x = 3:9, y = 2, backend="mxnet", training_frame = prostate.hex,
#                              hidden = c(100, 200), epochs = 5)
#  prostate.deepfeatures_layer1 =
#    h2o.deepfeatures(prostate.dl, prostate.hex, layer = "fc1_w")
#  prostate.deepfeatures_layer2 =
#    h2o.deepfeatures(prostate.dl, prostate.hex, layer = "fc2_w")
#  head(prostate.deepfeatures_layer1)
#  head(prostate.deepfeatures_layer2)
#}
# }