Description Usage Arguments See Also Examples
Saves a random forest for later use, given that the base R
save
function doesn't work for this package.
1 | saveForest(forest, directory, overwrite = FALSE)
|
forest |
The forest to save. |
directory |
The directory that should be created to save the trees in.
Note that if the directory already exists, an error will be displayed
unless |
overwrite |
Should the function overwrite an existing forest; FALSE by default. |
1 2 3 4 5 6 7 8 9 10 11 | # Regression Example
x1 <- rnorm(1000)
x2 <- rnorm(1000)
y <- 1 + x1 + x2 + rnorm(1000)
data <- data.frame(x1, x2, y)
forest <- train(y ~ x1 + x2, data,
ntree=100, numberOfSplits = 5, mtry = 1, nodeSize = 5)
saveForest(forest, "saved_forest")
new_forest <- loadForest("saved_forest")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.