vivi
Creates a matrix displaying variable importance on the diagonal and variable interaction on the off-diagonal.
vivi( data, fit, response, gridSize = 50, importanceType = NULL, nmax = NULL, reorder = TRUE, class = 1, predictFun = NULL )
data |
Data frame used for fit. |
fit |
A supervised machine learning model, which understands condvis2::CVpredict |
response |
The name of the response for the fit. |
gridSize |
The size of the grid for evaluating the predictions. |
importanceType |
One of either "%IncMSE" or "IncNodePurity" for use with randomForest. Or set to equal "agnostic" to override embedded importance measures and return agnostic importance values. |
nmax |
Maximum number of data rows to consider. |
reorder |
If TRUE (default) uses DendSer to reorder the matrix of interactions and variable importances. |
class |
Category for classification, a factor level, or a number indicating which factor level. |
predictFun |
Function of (fit, data) to extract numeric predictions from fit. Uses condvis2::CVpredict by default, which works for many fit classes. |
A matrix of interaction values, with importance on the diagonal.
aq <- na.omit(airquality)
f <- lm(Ozone ~ ., data = aq)
m <- vivi(fit = f, data = aq, response = "Ozone") # as expected all interactions are zero
viviHeatmap(m)
# Run an mlr ranger model:
library(mlr3)
library(mlr3learners)
library(ranger)
aq <- na.omit(airquality)
aq_Task <- TaskRegr$new(id = "airQ", backend = aq, target = "Ozone")
aq_lrn <- lrn("regr.ranger", importance = "permutation")
aq_fit <- aq_lrn$train(aq_Task)
m <- vivi(fit = aq_fit, data = aq, response = "Ozone")
viviHeatmap(m)
library(ranger)
rf <- ranger(Species ~ ., data = iris, importance = "impurity")
vivi(fit = rf, data = iris, response = "Species")Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.