Learn R Programming

rtemis (version 1.4.3)

varimp_ranking: Rank a Model's Variable Importance

Description

Summarize each importance measure across resamples and rank the variables by it, as plot_varimp() draws them.

Usage

varimp_ranking(x)

Value

data.frame with one row per measure, variable and resample with an available score: measure, variable, fold (resampled results only), value (the score), summary (the variable's mean across resamples), and rank (1 for the most important variable of the measure).

Arguments

x

Supervised, SupervisedRes or SHAP: Fitted model result or explanation.

Author

EDG

Details

Each measure is ranked as its direction declares: by larger values, by larger absolute values, or by smaller values; a measure with direction "none" is listed by decreasing value. A variable's summary is the mean of its available scores across resamples, computed by rtemis.draw::summarize_varimp(); an "absolute" measure ranks by the absolute value of that mean. NA scores and resamples without importance are excluded. A measure with no available score is omitted.

The table is in rank order within each measure, and in resample order within each variable, so the rows of the first n ranks of a measure are the rows of the n most important variables.

Examples

Run this code
mod <- train(iris, hyperparameters = setup_CART(), verbosity = 0L)
head(varimp_ranking(mod))

Run the code above in your browser using DataLab