Re: [R] a problem in random forest

From: Weiwei Shi <helprhelp_at_gmail.com>
Date: Wed 12 Oct 2005 - 04:32:50 EST

I am sorry for bother. I think I figured that out. the result of votes for test data is not rf$votes, but rf$test$votes

On 10/11/05, Weiwei Shi <helprhelp@gmail.com> wrote:
>
> Hi, there:
> I spent some time on this but I think I really cannot figure it out, maybe
> I missed something here:
>
> my data looks like this:
> > dim(trn3)
> [1] 7361 209
> > dim(val3)
> [1] 7427 209
>
> > mg.rf2<-randomForest(x=trn3[,1:208], y=trn3[,209], data=trn3,
> xtest=val3[, 1:208], ytest=val3[,209], importance=T)
>
> my test data has 7427 observations but after prediction,
> > dim(mg.rf2$votes)
> [1] 7361 2
>
> which has the same length as my training data.
>
> but if I use
> mg.rf<-randomForest(x=trn3[,1:208], y=trn3[,209], data=trn3, importance=T)
>
> followed by
> > mg.pred<-predict(mg.rf, newdata=val3[,1:208])
> > length(mg.pred)
> [1] 7427
>
> it works. But i need to know votes so I have to use the first way.
> Please help.
>
> Weiwei
> --
> Weiwei Shi, Ph.D
>
> "Did you always know?"
> "No, I did not. But I believed..."
> ---Matrix III
>

--
Weiwei Shi, Ph.D

"Did you always know?"
"No, I did not. But I believed..."
---Matrix III

	[[alternative HTML version deleted]]

______________________________________________
R-help@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
Received on Wed Oct 12 04:38:29 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 18:41:07 EST