Sören Künzel, Theo Saarinen, Jasjeet Sekhon, Allen Tang, Ling Xie
forestry is a fast implementation of Honest Random Forests.
The latest development version can be installed directly from Github using devtools:
if (!require("devtools")) install.packages("devtools")
devtools::install_github("soerenkuenzel/forestry")
The package contains compiled code, and you must have a development environment to install the development version. (Use devtools::has_devel()
to check whether you do.) If no development environment exists, Windows users download and install Rtools and macOS users download and install Xcode.
set.seed(292315)
library(forestry)
test_idx <- sample(nrow(iris), 3)
x_train <- iris[-test_idx, -1]
y_train <- iris[-test_idx, 1]
x_test <- iris[test_idx, -1]
rf <- forestry(x = x_train, y = y_train)
weights = predict(rf, x_test, aggregation = "weightMatrix")$weightMatrix
weights %*% y_train
predict(rf, x_test)
A fast implementation of random forests using ridge penalized splitting and ridge regression for predictions.
Must be install package from branch "RidgeArmadillo" to use Ridge Random Forest
if (!require("devtools")) install.packages("devtools")
devtools::install_github("soerenkuenzel/forestry", ref = "RidgeArmadillo")
Example:
set.seed(49)
library(forestry)
n <- c(100)
a <- rnorm(n)
b <- rnorm(n)
c <- rnorm(n)
y <- 4*a + 5.5*b - .78*c
x <- data.frame(a,b,c)
forest <- forestry(x, y, ridgeRF = TRUE)
predict(forest, x)