Skip to content

error in random forest

2 messages · Nagu, David Katz

#
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
1 day later
#
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: