Learn R Programming

h2o (version 2.8.4.4)

h2o.deepfeatures: Feature Generation via H2O Deep Learning Model

Description

Extract the non-linear features from a H2O dataset using a H2O deep learning model.

Usage

h2o.deepfeatures(data, model, key = "", layer = -1)

Arguments

data
An H2OParsedData object.
model
An H2ODeepLearningModel object that represents the deeplearning model to be used for feature extraction.
key
(Optional) The unique hex key assigned to the resulting dataset. If none is given, a key will automatically be generated.
layer
(Optional) Index of the hidden layer to extract. If none is given, the last hidden layer is chosen.)

Value

  • Returns an H2OParsedData object with as many features as the number of units in the hidden layer of specified index. If the model is supervised, and the data object has a column of the same name as the response with which the model was trained, then the response column will be prepended to the output frame.

See Also

H2OParsedData, H2ODeepLearningModel, h2o.deeplearning

Examples

Run this code
library(h2o)
localH2O = h2o.init()
prosPath = system.file("extdata", "prostate.csv", package = "h2o")
prostate.hex = h2o.importFile(localH2O, path = prosPath)
prostate.dl = h2o.deeplearning(x = 3:9, y = 2, data = prostate.hex, hidden = c(100, 200),
                               epochs = 5)
prostate.deepfeatures_layer1 = h2o.deepfeatures(prostate.hex, prostate.dl, layer = 1)
prostate.deepfeatures_layer2 = h2o.deepfeatures(prostate.hex, prostate.dl, layer = 2)
head(prostate.deepfeatures_layer1)
head(prostate.deepfeatures_layer2)

Run the code above in your browser using DataLab