prepFunc: prepFunction

Description Usage Arguments Value Examples

View source: R/prepFunction.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
prepFunc(
  task,
  learner,
  model,
  remove = FALSE,
  percentRemove = 0.5,
  parallel = FALSE
)

Arguments

task

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

learner

Learner created from the mlr3learners package.

model

Any machine learning model.

remove

If TRUE then remove the variables with low interaction strength.

percentRemove

The percentage of variables with low interaction strength to remove from the interaction calculation.

parallel

If TRUE then the method is executed in parallel.

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 <- prepFunc(task = aq_Task, learner = aq_lrn, model = aq_Mod)

# Create graph:
plotHeatMap(myMat)

AlanInglis/vivid documentation built on July 9, 2020, 1:53 a.m.