ggPlotForestFloor: plot forestFloor object with ggplot (beta)

Description Usage Arguments Details Author(s) Examples

Description

Method to plot an object of forestFloor-class. Plot partial feature contributions of the most important variables. Colour gradients can be applied two show possible interactions.

Usage

1
2
3
4
5
ggPlotForestFloor(ff,
                  plot_seq=NULL,
                  col=NULL,
                  orderByImportance = TRUE
                  )

Arguments

ff

foretFloor-object, also abbrivated ff.. Computed topology of randomForest-model, the output from the forestFloor function
includes also X and Y and importance data

plot_seq

a numeric vector describing which variables and in what sequence to plot, ordered by importance as default, order_by_importance = F then by feature/coloumn order of training data.

orderByImportance

TRUE / FALSE should plotting and plot_seq be ordered after importance. Most important feature plot first(TRUE)

col

color of points. Should either be one single colour or a vector of lenght N.samples with colour of each individual sample. Such vector is normally created with eg. ColVec=fcol(ff)

Details

Beta ggplot2 will gradually be implemented here. This function relies on ggplot2 and extraGrid

Author(s)

Soren Havelund Welling

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
##testing ggplot functionality
rm(list=ls())
library(forestFloor)
library(randomForest)
#simulate data
obs=1000
vars = 18
X = data.frame(replicate(vars,rnorm(obs)))
Y = with(X, X1^2 + sin(X2*pi) + 2 * X3 * X4 + 1 * rnorm(obs))
#grow a forest, remeber to include inbag
rfo=randomForest(X,Y,keep.inbag = TRUE,sampsize=250,ntree=50)
#compute topology
ff = forestFloor(rfo,X)
ggPlotForestFloor(ff,1:9)
plot(ff,1:9,col=fcol(ff))

## End(Not run)

forestFloor documentation built on May 2, 2019, 4:46 p.m.