h2o (version 2.8.4.4)

h2o.predict: H2O Model Predictions

Description

Obtains predictions from various fitted H2O model objects.

Usage

h2o.predict(object, newdata, ...)

Arguments

object
A fitted H2OModel object for which prediction is desired.
newdata
(Optional) A H2OParsedData object in which to look for variables with which to predict. If omitted, the data used to fit the model object@data are used.
...
Additional arguments to pass to h2o.predict. In particular variable num_pc for predicting on H2OPCAModel object is implemented.

Value

  • A H2OParsedData object containing the predictions.

Details

This method dispatches on the type of H2O model to select the correct prediction/scoring algorithm.

See Also

h2o.glm, h2o.kmeans, h2o.randomForest, h2o.prcomp, h2o.gbm, h2o.deeplearning

Examples

Run this code
library(h2o)
localH2O = h2o.init()
# Run GLM of CAPSULE ~ AGE + RACE + PSA + DCAPS
prostatePath = system.file("extdata", "prostate.csv", package = "h2o")
prostate.hex = h2o.importFile(localH2O, path = prostatePath, key = "prostate.hex")
prostate.glm = h2o.glm(y = "CAPSULE", x = c("AGE","RACE","PSA","DCAPS"), data = prostate.hex, 
   family = "binomial", nfolds = 0, alpha = 0.5)
# Get fitted values of prostate dataset
prostate.fit = h2o.predict(object = prostate.glm, newdata = prostate.hex)
summary(prostate.fit)

Run the code above in your browser using DataLab