Returns the most important variable names sorted descendingly.

most_important(x, top_m = Inf)

Arguments

x

An object of class "light_importance".

top_m

Maximum number of important variables to be returned.

Value

A character vector of variable names sorted in descending importance.

Examples

fit <- lm(Sepal.Length ~ ., data = iris)
fl <- flashlight(model = fit, label = "lm", data = iris, y = "Sepal.Length")
imp <- light_importance(fl)
most_important(imp)
#> [1] "Petal.Length" "Species"      "Petal.Width"  "Sepal.Width" 
most_important(imp, top_m = 2)
#> [1] "Petal.Length" "Species"