[R] Random Forest - Extract

Liaw, Andy andy_liaw at merck.com
Wed Oct 3 15:06:05 CEST 2012


1.  Not sure what you want.  What "details" are you looking for exactly?  If you call predict(trainset) without the newdata argument, you will get the (out-of-bag) prediction of the training set, which is exactly the "predicted"  component of the RF object.

2. If you set type="votes" and norm.votes=FALSE, you will get the counts instead of proportions.

Best,
Andy

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Lopez, Dan
Sent: Wednesday, September 26, 2012 9:05 PM
To: R help (r-help at r-project.org)
Subject: [R] Random Forest - Extract

Hello,

I have two Random Forest (RF) related questions.


1.       How do I view the classifications for the detail data of my training data (aka trainset) that I used to build the model? I know there is an object called predicted which I believe is a vector. To view the detail for my testset I use the below-bind the columns together. I was trying to do something similar for my trainset  but without putting it through the predict function. Instead taking directly from the randomForest which I stored in FOREST_model. I really need to get to this information to do some comparison of certain cases.

RF_DTL<-cbind(testset,predict(FOREST_model, testset, type="response"))



2.       In the RF model in R the predict function has three possible arguments: "response", "vote" or "prob". I noticed "vote and "prob" are identical for all records in my data set. Is this typical? If so then what is the point of having these two arguments? Ease of use?

Dan


	[[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Notice:  This e-mail message, together with any attachme...{{dropped:11}}



More information about the R-help mailing list