Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: varUsed Convenience Function #641

Open
DarioS opened this issue Oct 13, 2022 · 1 comment
Open

Enhancement: varUsed Convenience Function #641

DarioS opened this issue Oct 13, 2022 · 1 comment

Comments

@DarioS
Copy link

DarioS commented Oct 13, 2022

It would be nice to be able to easily discover which variables are ever used and which aren't, like varUsed in randomForest.

Variables Used in a Random Forest
Description
Find out which predictor variables are actually used in the random forest.
Usage
varUsed(x, by.tree = FALSE, count = TRUE)
[Package randomForest version 4.7-1.1]

@snembrini
Copy link

snembrini commented Dec 29, 2023

Hey Dario,
I know it's been a year, but I hope this helps (see attached function


rg.iris <- ranger(Species ~ ., data = iris, importance = "impurity",num.trees = 100)
varUsedRanger(rg.iris,by.tree = F,percent = T)

varUsedRanger.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants