From: Dror>
> Hi,
> I need help with the randomForest prediction. i run the folowing code:
>
> > iris.rf <- randomForest(Species ~ ., data=iris,
> > importance=TRUE,keep.forest=TRUE, proximity=TRUE)
> > pr<-predict(iris.rf,iris,predict.all=T)
> > iris.rf$votes[53,]
> setosa versicolor virginica
> 0.0000000 0.8074866 0.1925134
> > table(pr$individual[53,])/500
>
> versicolor virginica
> 0.928 0.072
> >
>
> why the voting is not the same for the same data? what do i do wrong?
It's because the $votes components reflects the OOB predictions, whereas
predict() gives you predictions based on all of the trees in the forest.
> another 2 questions:
> 1. i tries to debug another problem in which the individual vector was
> smaller the tree number in the forest.
> i noticed that in this row of code:
>
> treepred <- matrix(object$classes[t1$treepred], nrow =
> length(keep),
> dimnames = list(rn[keep], NULL))
> the t1$treepred has values of 0 (i have 2 classes) and they
> droped from the
> results
> what does this 0 mean?
Not sure why you're debugging that portion of the code. That is just to
dimension the array passed back from C into a matrix. What is "t1"?
> 2. how can i drop a tree from the forest?
Look at the $forest component of the randomForest object, and subset the
dimension that correspond to ntree in all of its components. Change
$ntree accordingly.
Andy
> Thanks,
> Dror
> --
> View this message in context:
> http://n4.nabble.com/Random-Forest-prediction-questions-tp1573
> 530p1573530.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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:10}}