fn_cross_index {scorecardModelUtils}R Documentation

Creates random index for k-fold cross validation

Description

The function base and returns a list of length k, to be used for k-fold cross validation sampling. Each element of the returned list is an array of random index for sampling for k-fold cross validation.

Usage

fn_cross_index(base, k)

Arguments

base

input dataframe

k

number of cross validation

Value

The function a list of length k, each holding an array of index/row number for sampling the base.

Author(s)

Arya Poddar <aryapoddar290990@gmail.com>

Examples

data <- iris
data$Species <- as.character(data$Species)
suppressWarnings(RNGversion('3.5.0'))
set.seed(11)
data$Y <- sample(0:1,size=nrow(data),replace=TRUE)
data$Y_pred <- sample(0:1,size=nrow(data),replace=TRUE)
data_k_list <- fn_cross_index(base = data,k = 5)
data_k_list$index1
data_k_list$index2
data_k_list$index3
data_k_list$index4
data_k_list$index5

[Package scorecardModelUtils version 0.0.1.0 Index]