1
votes

I'm using the caret package in R to run both random forest and xgboost models. And I want to get the variable importance of all 65 variables. I've tried varimp() function, and it could give me variable importance of the top 20 variables. Is there any way or options that I could have them for all 65 variables?

Thank you!!!

1
It's easier to help you if you provide some sort of reproducible example with sample input data and the desired output. That way we can easily test and verify possible solutions.MrFlick

1 Answers

0
votes

It computes them all. If you are printing or plotting, there is an argument called top that let's you control how many that are shown. The argument coming out of varImp has them all. I could give more details if you show a small reproducible example.