measure_importance: Importance of variables in a random forest

View source: R/measure_importance.R

measure_importanceR Documentation

Importance of variables in a random forest

Description

Get a data frame with various measures of importance of variables in a random forest

Usage

measure_importance(forest, mean_sample = "top_trees", measures = NULL)

Arguments

forest

A random forest produced by the function randomForest with option localImp = TRUE

mean_sample

The sample of trees on which mean minimal depth is calculated, possible values are "all_trees", "top_trees", "relevant_trees"

measures

A vector of names of importance measures to be calculated - if equal to NULL then all are calculated; if "p_value" is to be calculated then "no_of_nodes" will be too. Suitable measures for classification forests are: mean_min_depth, accuracy_decrease, gini_decrease, no_of_nodes, times_a_root. For regression forests choose from: mean_min_depth, mse_increase, node_purity_increase, no_of_nodes, times_a_root.

Value

A data frame with rows corresponding to variables and columns to various measures of importance of variables

Examples

forest <- randomForest::randomForest(Species ~ ., data = iris, localImp = TRUE, ntree = 300)
measure_importance(forest)


ModelOriented/randomForestExplainer documentation built on March 23, 2024, 10:31 p.m.