[R] cross validation in random forest using rfcv functin

David Winsemius dwinsemius at comcast.net
Thu Aug 24 19:04:46 CEST 2017


> On Aug 23, 2017, at 10:59 AM, Elahe chalabi via R-help <r-help at r-project.org> wrote:
> 
> Any responds?!

When I look at the original post a I see a question about a function named `rfcv` but do not see a `library` call to load such a function. I also see a reference to a help page or vignette, perhaps?, from that un-identified package. So it appears to me that you expect the rest of us to go searching for that function if we do not use it on a rtegular basis. You also apparently expect use to construct a dataset to reconstruct a dataset for testing. I'm not inclined to make all that effort, and from the crashing silence of the last 24 hours on this venue, it appears I am not alone in thinking you presume too much. Read the Posting Guide and try to better understand why your behavior might not be eliciting the level of interest you were hoping for.

-- David.


> 
> 
> 
> On Wednesday, August 23, 2017 5:50 AM, Elahe chalabi via R-help <r-help at r-project.org> wrote:
> 
> 
> 
> Hi all,
> 
> 
> I would like to do cross validation in random forest using rfcv function. As the documentation for this package says:
> 
> 
> rfcv(trainx, trainy, cv.fold=5, scale="log", step=0.5, mtry=function(p) max(1, floor(sqrt(p))), recursive=FALSE, ...)
> 
> 
> however I don't know how to build trianx and trainy for my data set, and I could not understand the way trainx is built in the package documentation example for iris data set.
> 
> Here is my data set and I want to do cross validation to see accuracy in classifying Alzheimer and Control Group:
> 
> 
> str(data)
> 
> 'data.frame':    499 obs. of  606 variables:
> 
> $ Gender        : int  0 0 0 0 0 1 1 1 1 1 ...
> 
> $ NumOfWords    : num  157 111 163 176 100 124 201 100 76 101
> 
> $ NumofLivings  : int  6 6 9 4 3 5 3 3 4 3 ...
> 
> $ NumofStopWords: num  77 45 87 91 46 64 104 37 32 41 ...
> 
> .
> 
> .
> 
> $ Group         : Factor w/ 2 levels "Alzheimer","Control","Control"..:
> 
> 
> So basically trainy should be data$Group but how about trainx? Could anyone help me in this?
> 
> 
> 
> Thanks for any help!
> 
> Elahe
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   -Gehm's Corollary to Clarke's Third Law



More information about the R-help mailing list