R/analysis_tools.R
split_frequencies.Rd
Calculate which features the forest split on at each depth.
split_frequencies(forest, max.depth = 4)
forest | The trained forest. |
---|---|
max.depth | Maximum depth of splits to consider. |
A matrix of split depth by feature index, where each value is the number of times the feature was split on at that depth.
# \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 split frequencies for this forest. split_frequencies(q.forest)#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] #> [1,] 952 122 96 158 100 155 126 90 96 105 #> [2,] 1074 304 274 313 239 344 307 276 279 255 #> [3,] 949 492 495 440 473 468 506 429 432 460 #> [4,] 858 619 564 595 520 541 548 511 499 611# }