Description Usage Arguments Value Examples
View source: R/interaction_statistic.R
This function allows to plot the Hamilton feature interaction statistic
1 2 3 4 5 6 7 8 9 | interaction_statistic(
pred,
type = "overall",
feature = NA,
limits = c(0, 1),
title = "",
xlabel = "",
ylabel = "Interaction Statistic"
)
|
pred |
A prediction object from package iml |
type |
A character string indicating the type of the interaction statistic. Either "overall" (Default) or "2way" |
feature |
A character string indicating the name of the feature that is the basis for 2-way interactions |
limits |
An optional two-entry vector indicating the y-axis limits. Default is c(0,1) |
title |
An optional character string indicating the title of the plot |
xlabel |
An optional character string indicating x-axis label |
ylabel |
An optional character string indicating y-axis label |
a plot of type ggplot
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
N <- 1000
x1 <- runif(N, -1, 1)
x2 <- runif(N, -1, 1)
x3 <- runif(N, -1, 1)
y <- 5 + 5 * x1 * x2 + x3 + rnorm(N,1)
dat <- data.frame(x1,x2,x3,y)
rfmod <- randomForest::randomForest(y~., dat)
pred <- iml::Predictor$new(rfmod)
interaction_statistic(pred)
interaction_statistic(pred, type = "2way", feature = "x1")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.