Description Usage Arguments Value Examples
View source: R/permutation_importance.R
This function allows to plot permutation importance based on mean squared error. Three types are implemented: model-based permutation importance, random forest permutation importnance or conditional random forest variable importance
1 2 3 4 5 6 7 8 9 |
object |
A prediction object from package iml for model-based permutation importance or an object as returned by randomForest or cforest |
type |
A character indicating the type of variable importance: model-agnostic, randomforest, or conditional |
loss |
A character specifying the loss function for type = model-agnostic. See ?iml::FeatureImp for more details |
xlabel |
An optional character string indicating the x-axis label |
ylabel |
An optional character string indicating the y-axis label |
title |
An optional character string indicating the title of the plot |
limits |
An optional two-entry vector indicating the limits of the y-axis |
a plot of type ggplot
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)
x3 <- x2 + runif(N, -1, 1)
y <- 5 + 5 * x1 + 5 * x2 + 0 * x3 + rnorm(N,1)
dat <- data.frame(x1,x2,x3,y)
rfmod <- randomForest::randomForest(y~., dat)
pred <- iml::Predictor$new(rfmod)
permutation_importance(pred, type = "model-agnostic", limits = c(0,18), loss = "mse")
permutation_importance(rfmod, type = "randomforest", limits = c(0,18))
permutation_importance(rfmod, type = "conditional", limits = c(0,18))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.