Skip to content

Commit

Permalink
don't try to prune the root
Browse files Browse the repository at this point in the history
  • Loading branch information
mnwright committed May 16, 2024
1 parent 6101365 commit 2ecf6a0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/adversarial_rf.R
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ adversarial_rf <- function(
leaves <- which(out[[1]] == 0L)
to_prune <- leaves[!(leaves %in% which(tabulate(pred[, tree]) >= min_node_size))]
while(length(to_prune) > 0) {
if (1 %in% to_prune) {
# Never prune the root
break
}
for (tp in to_prune) {
# Find parents
parent <- which((out[[1]] + 1L) == tp)
Expand Down

0 comments on commit 2ecf6a0

Please sign in to comment.