h2o.ice_plot: Plot Individual Conditional Expectation (ICE) for each decile

Description Usage Arguments Value Examples

View source: R/explain.R

Description

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.

Usage

1
h2o.ice_plot(model, newdata, column, target = NULL, max_levels = 30)

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.

Value

A ggplot2 object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## 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)

## End(Not run)

h2o documentation built on Oct. 10, 2021, 1:08 a.m.