sampling {scorecardModelUtils} | R Documentation |
Random sampling of data into train and test
Description
The function does random sampling of the data and split it into train and test datasets. Training base percentage and seed value(optional) is taken as arguments. If seed value is not specified, random seed will be generated on different iterations.
Usage
sampling(base, train_perc = 0.7, seed = NA, replace = F)
Arguments
base |
input dataframe |
train_perc |
(optional) percentage of total base to be kept as training sample, to be provided as decimal/fraction (default percentage is 0.7) |
seed |
(optional) seed value (if not given random seed is generated) |
replace |
(optional) whether replacement will e with or without replacement (default is FALSE ie. without replacement) |
Value
An object of class "sampling" is a list containing the following components:
train_sample |
training sample as a dataframe |
test_sample |
test sample as a dataframe |
seed |
seed used |
Author(s)
Arya Poddar <aryapoddar290990@gmail.com>
Examples
data <- iris
sampling_list <- sampling(base = data,train_perc = 0.7,seed = 1234)
sampling_list$train
sampling_list$test
sampling_list$seed
[Package scorecardModelUtils version 0.0.1.0 Index]