R/analysis_tools.R
variable_importance.Rd
A simple weighted sum of how many times feature i was split on at each depth in the forest.
variable_importance(forest, decay.exponent = 2, max.depth = 4)
forest | The trained forest. |
---|---|
decay.exponent | A tuning parameter that controls the importance of split depth. |
max.depth | Maximum depth of splits to consider. |
A list specifying an 'importance value' for each feature.
# \donttest{ # Train a quantile forest. n <- 250 p <- 10 X <- matrix(rnorm(n * p), n, p) Y <- X[, 1] * rnorm(n) q.forest <- quantile_forest(X, Y, quantiles = c(0.1, 0.5, 0.9)) # Calculate the 'importance' of each feature. variable_importance(q.forest)#> [,1] #> [1,] 0.25744941 #> [2,] 0.05249690 #> [3,] 0.06866620 #> [4,] 0.05559858 #> [5,] 0.11015747 #> [6,] 0.07746014 #> [7,] 0.06883904 #> [8,] 0.08823708 #> [9,] 0.12806624 #> [10,] 0.09302893# }