View source: R/rand_forest-orf.R
| orf_wrapper | R Documentation |
orfThe orf package uses a non-standard interface that requires the predictor
matrix X and the outcome vector Y as separate arguments, with Y as a
numeric vector. This wrapper converts the parsnip-standard data.frame (X)
and factor (Y) to the required formats before calling orf::orf().
orf_wrapper(X, Y, ...)
X |
The predictor data (data.frame). |
Y |
The outcome factor. |
... |
Additional arguments to pass. |
An object of S3 class orf as returned by orf::orf().
house_data <-
MASS::housing[rep(seq(nrow(MASS::housing)), MASS::housing$Freq), -5]
house_data <- house_data[sample(nrow(house_data), 50), ]
# encode factors as dummy variables before passing to wrapper
X_mat <- model.matrix(~ Infl + Type + Cont - 1, data = house_data)
# fit wrapper
( fit_wrap <- orf_wrapper(
X = X_mat,
Y = house_data$Sat,
num.trees = 10
) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.