plotNetwork: plotNetwork

Description Usage Arguments Value Examples

View source: R/plotNetwork.R

Description

Create a Network style plot displaying Variable and Variable Interaction.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
plotNetwork(
  mat,
  thresholdValue = 0,
  label = FALSE,
  minInt = 0,
  maxInt = NULL,
  minImp = 0,
  maxImp = NULL,
  labelNudge = 0.05,
  layout = "circle",
  cluster = F,
  ...
)

Arguments

mat

A matrix of values to be plotted. Either added by the user or created using the prepFunc() function.

thresholdValue

A value chosen by the user which will show all the edges with weights (i.e., the interacions) above that value. For example, if thresholdValue = 0.2, then only the the interacions greater than 0.2 will be displayed.

label

If label = TRUE the numerical value for the interaction strength will be displayed.

minInt

Minimum interaction strength to be displayed on the legend.

maxInt

Maximum interaction strength to be displayed on the legend.

minImp

Minimum importance value to be displayed on the legend.

maxImp

Maximum importance value to be displayed on the legend.

labelNudge

A value, set by the user, to determine the y_postioning of the variables names. A higher value will postion the label farther above the nodes.

layout

Determines the shape, or layout, of the plotted graph.

cluster

If cluster = TRUE, then the data is clustered in groups.

...

Not currently implemented.

Value

A newtwork style plot displaying interaction strength between variables on the edges and variable importance on the nodes.

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:
plotNetwork(myMat, thresholdValue = 0, cluster = F)

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