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]]