Description Usage Arguments Value Examples
This function allows to create PD, ICE, ALE plots ICE plots can be centered at the minimum Plots for several features of one model can be created at the same time
1 2 3 4 5 6 7 8 9 10 11 12 13 |
pred |
A prediction object from package iml |
features |
A character vector containing the names of the features for which the plot should be created |
method |
A character string indicating the method to be applied: either "pdp", "pdp+ice", "ice", or "ale" |
xlabel |
An optional character vector indicating x-axis label |
ylabel |
An optional character string indicating y-axis label |
title |
An optional character string indicating the title of the plot |
center |
Logical indicating whether ICE curves should be centered at the minimum. Default is FALSE |
limits |
An optional two-entry vector indicating the limits of the y-axis |
nCol |
An optional numeric entry indicating the number of columns when plots are created for several features |
alpha |
An optional numeric entry indicating the alpha-level of ICE curves |
sample_prop |
An optional numeric entry between 0 and 1 indicating the percentage of individiuals that should be sampled for ICE curves |
a plot of type ggplotify
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
N <- 1000
x1 <- runif(N, -1, 1)
x2 <- runif(N, -1, 1)
y <- 5 + 2 * x1 + x2 + rnorm(N,1)
dat <- data.frame(x1,x2,y)
rfmod <- randomForest::randomForest(y~., dat)
pred <- iml::Predictor$new(rfmod)
pdp <- pdp_ice_ale(pred, "x1", method = "pdp")
ice <- pdp_ice_ale(pred, "x1", method = "ice", alpha = .1)
pdp_ice <- pdp_ice_ale(pred, "x1", method = "pdp+ice", alpha = .2)
ale <- pdp_ice_ale(pred, c("x1", "x2"), method = "ale", ylabel = "ALE")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.