cumimp.gradientForest | R Documentation |
gradientForest
object
Provide access to cumulative importance curves for a predictor. It is a generic function.
cumimp(x, ...)
## S3 method for class 'gradientForest'
cumimp(x, predictor, type = c("Overall", "Species")[1],
standardize=TRUE, standardize_after=FALSE, ...)
x |
an object of class |
predictor |
the name of the predictor |
type |
indicates the level of detail of the cumulative importance. The choices are
|
standardize |
logical, if |
standardize_after |
logical, if |
... |
further arguments for other methods |
If type
is "Overall", a single list with components x
and y
,
where x
is the predictor values and y
is the cumulative importance.
If type
is "Species", a list of such lists, one for each species.
N. Ellis, CSIRO, Cleveland, Australia. <Nick.Ellis@csiro.au>. S.J. Smith, DFO, Dartmouth, NS, Canada. <Stephen.Smith@dfo-mpo.gc.ca>
cumimp.combinedGradientForest
,importance.gradientForest
data(CoMLsimulation)
preds <- colnames(Xsimulation)
specs <- colnames(Ysimulation)
f1 <- gradientForest(data.frame(Ysimulation,Xsimulation), preds, specs[1:3], ntree=10)
par(mfrow=c(2,2))
cu.sp <- cumimp(f1, "A", "Species")
for (sp in names(cu.sp))
plot(cu.sp[[sp]],main=sp,xlab="A",ylab="Cumulative Importance")
plot(cumimp(f1, "A", "Overall"),main="Overall")
# Demonstrate differences between standardization before and after normalization
par(mfrow=c(2,1))
plot(density(f1,"A"),main="Density of predictor 'A'",xlab='A')
rug(sample(density(f1,"A")$x,100))
plot(cumimp(f1,"A",standardize=FALSE),type='n',main="",ylab="Cum. importance",xlab='A')
lines(cumimp(f1,"A"),type='l',col="black")
lines(cumimp(f1,"A",standardize_after=TRUE),type='l',col="blue")
lines(cumimp(f1,"A",standardize=FALSE),type='l',col="red")
legend(par("usr")[1],par("usr")[4],legend=c("Standardize then Normalize (default)",
"Normalize then Standardize","Normalize only"),col=c("black","blue","red"),lty=1,cex=0.8)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.