Question



RandomForest Prediction in Project

Hey Dr. Ballings,

Could you help me with this error I am receiving when running my randomforest. I have googled a ton of stuff and the only conclusion I can
come to is the structure of the data set may not be right for my (x) variable in the data.frame or there are to many different stocks to run
random forest on.

Here is the error I keep receiving. Could you please provide some insight?

Error in randomForest.default(x = trainsubset, y = Dependent.Variable, :
Can not handle categorical predictors with more than 53 categories.

Thanks





Answers and follow-up questions





Answer or follow-up question 1

Dear student,

As the error indicates, randomForest cannot handle variables (in your case one or more variables in trainsubset)
with more than 53 categories. The solution is to either remove that variable or create dummy variables like
we saw in class.

Michel Ballings





Sign in to be able to add an answer or mark this question as resolved.