Last active
July 29, 2022 14:15
-
-
Save brunaw/25aedf69fc324c6311b77448b617f630 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
devtools::install_github("imbs-hl/ranger") | |
library(ranger) | |
data("mtcars") | |
regularized_rf <- ranger(mpg ~ ., | |
data = mtcars, | |
num.trees = 100, | |
num.threads = 1, # needs to be set to | |
# avoid parallelization | |
mtry = 7, | |
regularization.factor = 0.3) | |
standard_rf <- ranger(mpg ~ ., | |
num.trees = 100, | |
data = mtcars, | |
mtry = 7) | |
# Prediction errors | |
regularized_rf$prediction.error | |
standard_rf$prediction.error | |
# Number of variables used | |
length(unique(unlist(regularized_rf$forest$split.varIDs))) | |
length(unique(unlist(standard_rf$forest$split.varIDs))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment