loadForest: Load Random Forest

Description Usage Arguments Value See Also Examples

View source: R/loadForest.R

Description

Loads a random forest that was saved using saveForest.

Usage

1
2
loadForest(directory, forest.output = c("online", "offline"),
  maxTreeNum = NULL)

Arguments

directory

The directory created that saved the previous forest.

forest.output

Specifies whether the forest loaded should be loaded into memory, or reflect the saved files where only one tree is loaded at a time.

maxTreeNum

If for some reason you only want to load the number of trees up until a certain point, you can specify maxTreeNum as a single number.

Value

A JForest object; see train for details.

See Also

train, saveForest

Examples

 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, "trees")
new_forest <- loadForest("trees")

jatherrien/largeRCRF documentation built on Nov. 15, 2019, 7:16 a.m.