Individual Conditional Expectation (ICE) plot gives a graphical depiction of the marginal effect of a variable on the response. ICE plots are similar to partial dependence plots (PDP); PDP shows the average effect of a feature while ICE plot shows the effect for a single instance. This function will plot the effect for each decile. In contrast to the PDP, ICE plots can provide more insight, especially when there is stronger feature interaction. Also, the plot shows the original observation values marked by semi-transparent circle on each ICE line. Please note, that the score of the original observation value may differ from score value of underlying ICE line at original observation point as ICE line is drawn as an interpolation of several points.

h2o.ice_plot(
  model,
  newdata,
  column,
  target = NULL,
  max_levels = 30,
  show_pdp = TRUE,
  binary_response_scale = c("response", "logodds"),
  centered = FALSE,
  grouping_column = NULL,
  output_graphing_data = FALSE,
  nbins = 100,
  show_rug = TRUE,
  ...
)

Arguments

model

An H2OModel.

newdata

An H2OFrame.

column

A feature column name to inspect.

target

If multinomial, plot PDP just for target category. Character string.

max_levels

An integer specifying the maximum number of factor levels to show. Defaults to 30.

show_pdp

Option to turn on/off PDP line. Defaults to TRUE.

binary_response_scale

Option for binary model to display (on the y-axis) the logodds instead of the actual score. Can be one of: "response", "logodds". Defaults to "response".

centered

A boolean whether to center curves around 0 at the first valid x value or not. Defaults to FALSE.

grouping_column

A feature column name to group the data and provide separate sets of plots by grouping feature values

output_graphing_data

A bool whether to output final graphing data to a frame. Defaults to FALSE.

nbins

A number of bins used. Defaults to 100.

show_rug

Show rug to visualize the density of the column. Defaults to TRUE.

...

Custom parameters.

Value

A ggplot2 object

Examples

# NOT RUN {
library(h2o)
h2o.init()

# Import the wine dataset into H2O:
f <- "https://h2o-public-test-data.s3.amazonaws.com/smalldata/wine/winequality-redwhite-no-BOM.csv"
df <-  h2o.importFile(f)

# Set the response
response <- "quality"

# Split the dataset into a train and test set:
splits <- h2o.splitFrame(df, ratios = 0.8, seed = 1)
train <- splits[[1]]
test <- splits[[2]]

# Build and train the model:
gbm <- h2o.gbm(y = response,
               training_frame = train)

# Create the individual conditional expectations plot
ice <- h2o.ice_plot(gbm, test, column = "alcohol")
print(ice)
# }