vividMatrix: vividMatrix

Description Usage Arguments Value Examples

View source: R/interactionMatrix.R

Description

Creates a matrix displaying Variable importance on the diagonal and Variable Interaction on the off-diagonal.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
vividMatrix(
  task,
  model,
  filter = NULL,
  gridSize = 10,
  normalize = FALSE,
  nmax = 500,
  sqrt = TRUE,
  reorder = TRUE,
  main = NULL,
  ...
)

Arguments

task

Task created from the mlr3 package, either regression or classification.

model

A machine learning model created from mlr3 task and learner.

gridSize

The size of the grid for evaluating the predictions.

normalize

Should the variances explained be normalized? Default is FALSE.

nmax

Maximum number of data rows to consider.

sqrt

In order to reproduce Friedman's H statistic, resulting values are root transformed. Set to FALSE if squared values should be returned.

reorder

If TRUE (default) uses DendSer to reorder the matrix of interactions and variable importances.

main

Define main category for classification.

Value

A matrix of values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Load in the data:
aq <- data.frame(airquality)
aq <- na.omit(aq)

# Run an mlr ranger model:
library(mlr3)
library(mlr3learners)
library(ranger)
aq_Task <- TaskRegr$new(id = "airQ", backend = aq, target = "Ozone")
aq_lrn <- lrn("regr.ranger", importance = "permutation")
aq_Mod <- aq_lrn$train(aq_Task)

# Create matrix
myMat <- vividMatrix(task = aq_Task, model = aq_Mod)

# Create graph:
plot(myMat, type = "heatMap")

AlanInglis/vividOld documentation built on March 4, 2021, 12:44 a.m.