trainTest: Train / test split

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/trainTest.R

Description

Split a data set into train and test set.

Usage

1
trainTest(data, trainpart = 0.6, stratify = FALSE)

Arguments

data

the data to use. The structure returned by input.

trainpart

the fraction of the data to use for training. Default 0.6.

stratify

whether to stratify the folds. Makes really only sense for classification models. Defaults to FALSE.

Details

Partitions the data set into training and test set according to the specified fraction. The training and test index sets are added to the original data and returned. If requested, the distribution of the best algorithms in training and test set is approximately the same, i.e. the sets are stratified.

If the data set has train and test partitions already, they are overwritten.

Value

train

a (one-element) list of index sets for training.

test

a (one-element) list of index sets for testing.

...

the original members of data. See input.

Author(s)

Lars Kotthoff

See Also

bsFolds, cvFolds

Examples

1
2
3
4
5
6
7
8
data(satsolvers)
trainTest = trainTest(satsolvers)

# use 50-50 split instead of 60-40
trainTest1 = trainTest(satsolvers, 0.5)

# stratify
trainTestU = trainTest(satsolvers, stratify=TRUE)

llama documentation built on March 17, 2021, 1:06 a.m.