Description Usage Arguments Value Examples
View source: R/visualization.R
Plot decision boundaries, prediciton areas and original data for two features.
1 2 | plotClassification2D(model, task, features, grid.res = 100,
x1.lim = NULL, x2.lim = NULL, colours = FALSE)
|
model |
[mlr WrappedModdel object] |
task |
[mlr classification task object] Created by mlr::makeClassifTask |
features |
[ |
grid.res |
[ |
x1.lim |
[ |
x2.lim |
[ |
colours |
[ |
ggplot object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | library(mlr)
library(ggplot2)
theme_set(theme_light())
# visualize randomForest predictions on iris data
require(randomForest)
iris.mod.rf = train(makeLearner("classif.randomForest"), iris.task)
plotClassification2D(iris.mod.rf, iris.task, features = c("Petal.Length", "Petal.Width"))
# recreate plots from chapter 2 of "Elements of Statistical Learning"
require(ElemStatLearn)
me = ElemStatLearn::mixture.example
df = data.frame(x1 = me$x[,1], x2 = me$x[,2], y = factor(me$y))
tsk = makeClassifTask(data = df, target = "y")
spam.knn = train(makeLearner("classif.knn", k = 15), tsk)
plotClassification2D(spam.knn, tsk, features = c("x1", "x2"), colours = "ESL")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.