[R] error in random forest

David Katz david at davidkatzconsulting.com
Sun Mar 9 02:34:28 CET 2008


I've had the same problem and solved it by removing the cases with the new
levels - they need to be handled some other way, either by building a new
model or reassigning the factor level to one in the training set.



Nagu wrote:
> 
> Hi,
> 
> I get the following error when I try to predict the probabilities of a
> test sample:
> 
> Error in predict.randomForest(fit.EBA.OM.rf.50, x.OM, type = "prob") :
>   New factor levels not present in the training data
> 
> I have about 630 predictor variables in the dataset x.OM (25 factor
> variables and the remaining are continuous variables). Any ideas on
> how to trace it?
> 
> Thank you,
> Nagu
> 
> ______________________________________________
> 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/error-in-random-forest-tp15904235p15922797.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list