measure_importance: Importance of variables in a random forest

Description Usage Arguments Value Examples

View source: R/measure_importance.R

Description

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

Usage

1
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

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

randomForestExplainer documentation built on July 12, 2020, 1:06 a.m.