nano_single_pdp | R Documentation |
Creates PDPs for variable(s) for a single h2o model.
nano_single_pdp(model, data, vars, max_levels = 30, row_index = -1)
model |
a h2o model. |
data |
a dataset. Dataset used to create |
vars |
vector of characters. Vector containing variables in |
max_levels |
a numeric. Maximum number of unique levels to calculate pdp for each variable. |
row_index |
a numeric vector of dataset rows numbers to be used to calculate PDPs. To use entire dataset, set to -1. |
Creates a pdp for each variable specified in the vars
argument given a h2o
model.
For creating pdps, it is recommended to instead use the nano_pdp
function
which is a wrapper for a series of functions which creates pdps. It is able to create
pdps directly from a nano object, for both single and multi models, and has the option
to return plots of the pdps.
a data.tables containing pdps for each variable combined together.
## Not run:
if(interactive()){
library(h2o)
library(nano)
h2o.init()
# import dataset
data(property_prices)
train <- as.h2o(property_prices)
# set the response and predictors
response <- "sale_price"
var <- setdiff(colnames(property_prices), response)
# build model
grid <- h2o.grid(x = var,
y = response,
training_frame = train,
algorithm = "randomForest",
hyper_params = list(ntrees = 1:2),
nfolds = 3,
seed = 628)
model <- h2o.getModel(grid@model_ids[[1]])
# calculate pdp
nano_single_pdp(model, property_prices, c("lot_size"))
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.