mplot3_decision: 'mplot3': Decision boundaries

View source: R/mplot3_decision.R

mplot3_decisionR Documentation

mplot3: Decision boundaries

Description

Plot classification decision boundaries of rtemis models

Usage

mplot3_decision(
  rtmod,
  data,
  vars = c(1, 2),
  dots.per.axis = 100,
  bg.cex = 0.5,
  bg.alpha = 0.4,
  bg.pch = 15,
  par.reset = TRUE,
  theme = "white",
  col = c("#18A3AC", "#F48024"),
  contour.col = "black",
  contour.lwd = 0.1,
  point.pch = c(3, 4),
  point.alpha = 1
)

Arguments

rtmod

rtemics trained model

data

Matrix / data frame of features; last column is class

vars

Integer vector, length 2: Index of features (columns of x) to use to draw decision boundaries. Default = c(1, 2)

dots.per.axis

Integer: Draw a grid with this many dots on each axis. Default = 100

bg.cex

Float: Point cex for background / decision surface. Default = .5

bg.alpha

Float: Point alpha for background / decision surface. Default = .2

bg.pch

Integer vector: pch for background / decision surface. Default = c(3, 4)

par.reset

Logical: If TRUE, reset par before exiting. Default = TRUE

theme

Character: Theme for mplot3_xy, "light" or "dark". Default = "light'

col

Color vector for classes. Default = ucsfPalette

contour.col

Color for decision boundary. Default = "black"

contour.lwd

Float: Line width for decision boundary. Default = .3

point.pch

Integer: pch for data points. Default = c(3, 4)

point.alpha

Float: Alpha for data points. Default = 1

Details

If data has more than 2 variables, any variable not selected using vars will be fixed to their mean Underlying model (e.g. randomForest, rpart, etc) must support standard R predict format for classification: predict(model, newdata, type = "class")

Value

Predicted labels for background grid (invisibly)

Author(s)

E.D. Gennatas

Examples

## Not run: 
dat <- as.data.frame(mlbench::mlbench.2dnormals(200))
mod.cart <- s_CART(dat)
mod.rf <- s_RF(dat)
mplot3_decision(mod.cart, dat)
mplot3_decision(mod.rf, dat)

## End(Not run)

egenn/rtemis documentation built on Nov. 22, 2024, 4:12 a.m.