createTrainDataFolds: Create the training data for each of the k models in k-fold...

View source: R/latrend.R

createTrainDataFoldsR Documentation

Create the training data for each of the k models in k-fold cross validation evaluation

Description

Create the training data for each of the k models in k-fold cross validation evaluation

Usage

createTrainDataFolds(
  data,
  folds = 10L,
  id = getOption("latrend.id"),
  seed = NULL
)

Arguments

data

A data.frame representing the complete dataset.

folds

The number of folds. By default, a 10-fold scheme is used.

id

The trajectory identifier variable.

seed

The seed to use, in order to ensure reproducible fold generation at a later moment.

Value

A list of data.frame of the folds training datasets.

See Also

Other validation methods: createTestDataFolds(), createTestDataFold(), latrendBoot(), latrendCV(), lcModel-data-filters

Examples

data(latrendData)
method <- lcMethodLMKM(Y ~ Time, id = "Id", time = "Time")

if (require("caret")) {
  trainFolds <- createTrainDataFolds(latrendData, folds = 5, id = "Id", seed = 1)

  foldModels <- latrendBatch(method, data = trainFolds)
  testDataFolds <- createTestDataFolds(latrendData, trainFolds)
}

latrend documentation built on March 31, 2023, 5:45 p.m.