R/analysis_tools.R
split_frequencies.RdCalculate 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,] 822 145 102 114 140 130 263 87 104 93 #> [2,] 897 337 313 344 343 329 361 281 315 294 #> [3,] 962 480 472 529 474 468 548 447 537 456 #> [4,] 910 552 550 590 576 537 600 519 594 528# }