Re-evaluating the tree in the random forest
From: Martin Lam
Dear mailinglist members,
I was wondering if there was a way to re-evaluate the
instances of a tree (in the forest) again after I have
manually changed a splitpoint (or split variable) of a
decision node. Here's an illustration:
library("randomForest")
forest.rf <- randomForest(formula = Species ~ ., data
= iris, do.trace = TRUE, ntree = 3, mtry = 2,
norm.votes = FALSE)
# I am going to change the splitpoint of the root node
of the first tree to 1
forest.rf$forest$xbestsplit[1,]
forest.rf$forest$xbestsplit[1,1] <- 1
forest.rf$forest$xbestsplit[1,]
Because I've changed the splitpoint, some instances in
the leafs are not supposed where they should be. Is
there a way to reappoint them to the correct leaf?
I'm not sure what you want to do exactly, but I suspect you can use predict().
I was also wondering how I should interpret the output
of do.trace:
ntree OOB 1 2 3
1: 3.70% 0.00% 6.25% 5.88%
2: 3.49% 0.00% 3.85% 7.14%
3: 3.57% 0.00% 5.56% 5.26%
What's OOB and what does the percentages mean?
OOB stands for `Out-of-bag'. Read up on random forests (e.g., the article in R News) to learn about it. Those numbers are estimated error rates. The `OOB' column is across all data, while the others are for the classes. Andy
Thanks in advance, Martin
______________________________________________________ Click here to donate to the Hurricane Katrina relief effort. ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html