
Forest feature importance, MDI (Geron Ch 7, morie.fn grfim)
Source:R/geron_train_native.R
morie_geron_feature_importance_mdi.RdPer-tree impurity decreases normalised to sum 1, then averaged.
spread is the ddof = 1 standard deviation; ranking is 0-based and
stable (order(method = "radix") matches numpy's stable argsort).
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_geron_feature_importance_mdi(V)
#> $importance
#> [1] 0.02777778 0.05555556 0.08333333 0.11111111 0.13888889 0.16666667 0.19444444
#> [8] 0.22222222
#>
#> $spread
#> [1] 0 0 0 0 0 0 0 0
#>
#> $ranking
#> [1] 7 6 5 4 3 2 1 0
#>
#> $per_tree_normalized
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7]
#> [1,] 0.02777778 0.05555556 0.08333333 0.1111111 0.1388889 0.1666667 0.1944444
#> [,8]
#> [1,] 0.2222222
#>
#> $n_trees
#> [1] 1
#>
#> $n_features
#> [1] 8
#>
#> $estimate
#> [1] 0.02777778 0.05555556 0.08333333 0.11111111 0.13888889 0.16666667 0.19444444
#> [8] 0.22222222
#>
#> $n
#> [1] 1
#>