R/models.R
Partial dependence plot gives a graphical depiction of the marginal effect of a variable on the response. The effect of a variable is measured in change in the mean response. Note: Unlike randomForest's partialPlot when plotting partial dependence the mean response (probabilities) is returned rather than the mean of the log class probability.
h2o.partialPlot(object, data, cols, destination_key, nbins = 20, plot = TRUE, plot_stddev = TRUE)
object | An H2OModel object. |
---|---|
data | An H2OFrame object used for scoring and constructing the plot. |
cols | Feature(s) for which partial dependence will be calculated. |
destination_key | An key reference to the created partial dependence tables in H2O. |
nbins | Number of bins used. For categorical columns make sure the number of bins exceed the level count. |
plot | A logical specifying whether to plot partial dependence table. |
plot_stddev | A logical specifying whether to add std err to partial dependence plot. |
Plot and list of calculated mean response tables for each feature requested.
# NOT RUN { library(h2o) h2o.init() prostate.path <- system.file("extdata", "prostate.csv", package="h2o") prostate.hex <- h2o.uploadFile(path = prostate.path, destination_frame = "prostate.hex") prostate.hex[, "CAPSULE"] <- as.factor(prostate.hex[, "CAPSULE"] ) prostate.hex[, "RACE"] <- as.factor(prostate.hex[,"RACE"] ) prostate.gbm <- h2o.gbm(x = c("AGE","RACE"), y = "CAPSULE", training_frame = prostate.hex, ntrees = 10, max_depth = 5, learn_rate = 0.1) h2o.partialPlot(object = prostate.gbm, data = prostate.hex, cols = c("AGE", "RACE")) # }