connectToData: Connect To Data

Description Usage Arguments Value Examples

View source: R/connectToData.R

Description

When a trained forest is saved, the training dataset is not saved alongside it. When it's loaded back up, it can be more convenient (and in some cases necessary) to import the training dataset back into the Java environment so that it's readily accessible. There are only two functions that look for the training dataset: predict, where you can easily just specify an alternative dataset, or addTrees, which requires the training dataset be connected.

Usage

1
connectToData(forest, responses, covariateData)

Arguments

forest

The forest to connect data too

responses

The responses in the data; aka the left hand side of the formula

covariateData

A data.frame containing all of the covariates used in the training dataset

Value

The same forest, but connected to the training data.

Examples

1
2
3
4
5
data <- data.frame(x1=rnorm(1000), x2=rnorm(1000), y=rnorm(1000))
forest <- train(y~x1+x2, data, ntree=100, numberOfSplits=0, nodeSize=1, mtry=1)
forest$dataset <- NULL # what the forest looks like after being loaded

forest <- connectToData(forest, data$y, data)

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