This is the problem I am facing right now:
I have a dataset with 100.000 samples and 20 predictors. The predictors are correlated with each other due to their nature. I've run two different random forest models with a sample of the dataset (see why I used a subsample in the explanation below):
- The first random forest was from the party package
- The second random forest was from the randomForest package
My objective, aside from predicting a certain variable with the model, is to find out the importance of the predictors.
According to the test I ran with a subsample of the entire dataset, I got contraddictory answers on variable importance using party and randomForest.
Party, when using the function:
varimp(cf_fit,conditional=TRUE)
with the argument conditional set to TRUE, seems to output an answer that "makes more sense" (based on my knowledge of the subject) compared to the answer of the randomForest's
importance()
function.
By reading a bit deeper into the literature, I found out that this is common when using correlated predictors. Since the party package is partially doing a better job than the alternatives, I would like to use it, however, when feeding the whole dataset, the function varimp(cf_fit,conditional=TRUE) crashes the program. Again, I read that this is quite common or, at least, it is common for this function to be really slow, which it definitely is, even when using only a subsample.
Finally, my question:
How can I calculate the variable importance accounting for variable correlation? (ie: how can I do what the function varimp(cf_fit,conditional=TRUE) is doing so slowly at best, and crashing at worst?)
My proposed answers:
1) I simply don't do it this way and try to find the best predictors by running different times the random forest with different subset of predictors (possibly those with the least correlation among themselves), then I choose the independent predictors yielding the best results and only then I calculate variable importance.
2) Use a faster machine and try using party's varimp(cf_fit,conditional=TRUE) function anyway. I'm not sure this is a hardware problem... speculation time... is it maybe related to the way this function works?
Thanks to everyone in advance!