nano_single_ice | R Documentation |
Creates ICEs for variable(s) for a single h2o model.
nano_single_ice(
model,
data,
vars,
max_levels = 30,
quantiles = seq(0, 1, 0.1),
targets = NULL
)
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 ICE for each variable. |
quantiles |
a numeric vector of quantiles (numbers from 0 to 1) for each ICE to be calculated for. |
targets |
a character vector. Only applicable for classification models. Subset of levels of response variables which ICE should be calculated for. |
Creates a ICE for each variable specified in the vars
argument given a h2o
model.
For creating ICE, it is recommended to instead use the nano_ice
function
which is a wrapper for a series of functions which creates pdps. It is able to create
ICEs directly from a nano object, for both single and multi models, and has the option
to return plots of the ICEs.
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 ICE
nano_single_ice(model = model,
data = property_prices,
vars = c("lot_size"),
quantiles = seq(0, 1, 0.1))
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.