Learn R Programming

rtemis (version 0.79)

mplot3.decision: 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.2, bg.pch = 15, par.reset = TRUE,
  theme = "light", col = c("#18A3AC", "#F48024"),
  contour.col = "black", contour.lwd = 0.3, 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

String: 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

Value

Predicted labels for background grid (invisibly)

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")

Examples

Run this code
# 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)
# }

Run the code above in your browser using DataLab