Description Usage Arguments Value Examples
This function allows to plot 2-dimensional pdp, ale figures. Please note ale for two categorical features is not yet implemented, and that the categorical feature must be placed on the x-axis.
1 2 3 4 5 6 7 8 9 10 11 12 |
pred |
A prediction object from package iml |
features |
A character vector containing the names of two 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" |
title |
An optional character string indicating the title of the plot |
xlabel |
An optional character string indicating x-axis label (same for all panels) |
ylabel |
An optional character string indicating y-axis label (same for all panels) |
limits |
An optional two-entry vector indicating the limits of the y-axis |
show_data |
Logical indicating whether datapoints should be plotted. Default is FALSE |
legend_position |
Logical indicating whether the legend should be shown. Default is TRUE |
rugs |
Logical indicating whether rugs should be shown. Default is TRUE |
a plot of type ggplotify
1 2 3 4 5 6 7 8 9 10 11 12 | ## Not run:
N <- 1000
x1 <- runif(N, -1, 1)
x2 <- runif(N, -1, 1)
y <- 5 + 5 * x1 * x2 + rnorm(N,1)
dat <- data.frame(x1,x2,y)
rfmod <- randomForest::randomForest(y~., dat)
pred <- iml::Predictor$new(rfmod)
(twoD_pdPlot <- twoD_pdp_ale(pred, features = c("x1", "x2"), method = "pdp"))
(twoD_alePlot <- twoD_pdp_ale(pred, features = c("x1", "x2"), method = "ale"))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.