h2o_predict | R Documentation |
Prediction wrappers for fitted models with h2o engine that include data conversion, h2o server cleanup, and so on.
h2o_predict(object, new_data, ...)
h2o_predict_classification(object, new_data, type = "class", ...)
h2o_predict_regression(object, new_data, type = "numeric", ...)
## S3 method for class ''_H2OAutoML''
predict(object, new_data, id = NULL, ...)
object |
An object of class |
new_data |
A rectangular data object, such as a data frame. |
... |
Other options passed to |
type |
A single character value or |
id |
Model id in AutoML results. |
For AutoML, prediction is based on the best performing model.
For type != "raw", a prediction data frame with the same number of
rows as new_data
. For type == "raw", return the result of
h2o::h2o.predict()
.
if (h2o_running()) {
spec <-
rand_forest(mtry = 3, trees = 100) %>%
set_engine("h2o") %>%
set_mode("regression")
set.seed(1)
mod <- fit(spec, mpg ~ ., data = mtcars)
h2o_predict_regression(mod$fit, new_data = head(mtcars), type = "numeric")
# using parsnip
predict(mod, new_data = head(mtcars))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.