Learn R Programming

flashlight (version 0.9.0)

most_important: Most Important Variables.

Description

Returns the most important variable names sorted descendingly.

Usage

most_important(x, top_m = Inf)

# S3 method for default most_important(x, top_m = Inf)

# S3 method for light_importance most_important(x, top_m = Inf)

Value

A character vector of variable names sorted in descending order by importance.

Arguments

x

An object of class "light_importance".

top_m

Maximum number of important variables to be returned. Defaults to Inf, i.e., return all variables in descending order of importance.

Methods (by class)

  • most_important(default): Default method not implemented yet.

  • most_important(light_importance): Extracts most important variables from an object of class "light_importance".

See Also

light_importance()

Examples

Run this code
fit <- lm(Sepal.Length ~ ., data = iris)
fl <- flashlight(model = fit, label = "ols", data = iris, y = "Sepal.Length")
(imp <- light_importance(fl, seed = 4))
most_important(imp)
most_important(imp, 2)

Run the code above in your browser using DataLab