View source: R/rand_forest-ordinalForest.R
| ordinalForest_wrapper | R Documentation |
ordinalForestA wrapper is needed since they have a non-standard model interface that requires the data set and the column name (character string) for the outcome.
ordinalForest_wrapper(x, y, ...)
x |
The predictor data. |
y |
The outcome factor. |
... |
Additional arguments to pass. |
An object of S3 class ordfor as returned by
ordinalForest::ordfor().
house_data <-
MASS::housing[rep(seq(nrow(MASS::housing)), MASS::housing$Freq), -5]
# subsample to reduce runtime
house_data <- house_data[sample(nrow(house_data), nrow(house_data) / 10), ]
# fit wrapper
# (using inadvisedly few score sets and trees to reduce runtime)
( fit_orig <- ordinalForest::ordfor(
depvar = "Sat",
data = house_data,
nsets = 25, ntreefinal = 100
) )
( fit_wrap <- ordinalForest_wrapper(
x = subset(house_data, select = -Sat),
y = house_data$Sat,
nsets = 25, ntreefinal = 100
) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.