I'm using the GBM package for prediction in R. Traning works pretty well with a reasonable
error rate, however, when wanted to run the prediction on a training set that contains factor variable with new levels then I got the following error:

1 Answer
1

I'm not familiar with the GBM package, but the error suggest that GBM cannot deal with predicting from a model when the prediction data contains a previously unknown level. The rationale behind it is that the model can only say something about the class of data that it was trained for. In the case of a simple linear model, you cannot expect the model a~b (a depends on b) to predict data which involves a new variable b, i.e. a~b+c. The model has no trained behavior for b+c, only for for b.