Description Usage Arguments See Also Examples
rf_parcoor
produces parallel coordinates plots of the paths through a random forest. These visualisations are introduced and explained in our manuscript, a preprint of which is available from arXiv at https://arxiv.org/abs/1706.08702.
1 2 3 |
all.paths.out |
the result of supplying a random forest to |
plot |
if |
all.nodes |
If |
plot.title |
a character string specifying the title to display on the plot. |
plot.x.nodes |
the number of nodes along all paths to represent with parallel vertical axes |
colour.scale.log |
If |
colour.scale.lim |
The upper bound of the colour scale (if |
grey.scale |
If |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # example 1:
library(mlbench)
data(Satellite)
library(randomForest)
rf.1 <- randomForest(classes ~ ., data = Satellite, mtry = 8, keep.forest = TRUE, ntree = 25, importance = TRUE)
rf.1.all.paths <- rf_pathfinder(rf = rf.1)
rf.pc <- rf_parcoor(all.paths.out = rf.1.all.paths, plot = TRUE, all.nodes = TRUE, plot.title = '', grey.scale = FALSE)
rf.pc
# custom ordering of covariates on the vertical axis:
rf.pc + ggplot2::ylim(paste(c('Terminus', paste('x',1:36,sep = '.'))))
# grey scale version:
rf.pc.grey <- rf_parcoor(all.paths.out = rf.1.all.paths, plot = TRUE, all.nodes = TRUE, plot.title = '', grey.scale = TRUE)
rf.pc.grey
# interactive version with plotly (should work once geom_GeomCurve() is implemented in plotly)
# library(plotly)
# ggplotly(p = p1)
# example 2:
data(iris)
library(randomForest)
rf.2 <- randomForest(Species ~ ., data = iris, mtry = 2, keep.forest = TRUE, ntree = 100, importance = TRUE)
rf.2.all.paths <- rf_pathfinder(rf = rf.2)
rf.pc.2 <- rf_parcoor(all.paths.out = rf.2.all.paths, plot = TRUE, all.nodes = TRUE, plot.title = '', grey.scale = TRUE)
rf.pc.2
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.