tidy.gbm | R Documentation |
tidy returns a tibble of variable importance for the rpart pacakge
## S3 method for class 'gbm'
tidy(x, n_trees = x$n.trees, scale = FALSE, sort = TRUE, normalise = TRUE, ...)
x |
A |
n_trees |
integer. (optional) Number of trees to use for computing relative importance. Default is the number of trees in x$n.trees. If not provided, a guess is made using the heuristic: If a test set was used in fitting, the number of trees resulting in lowest test set error will be used; else, if cross-validation was performed, the number of trees resulting in lowest cross-validation error will be used; otherwise, all trees will be used. |
scale |
(optional) Should importance be scaled? Default is FALSE |
sort |
(optional) Should results be sorted? Default is TRUE |
normalise |
(optional) Should results be normalised to sum to 100? Default is TRUE |
... |
extra functions or arguments |
A tibble containing the importance score for each variable
# retrieve a tibble of the variable importance from an gbm model
library(gbm)
library(MASS)
fit_gbm <- gbm(calories ~., data = UScereal)
tidy(fit_gbm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.