create_folds_mc: Creation of folds for group-out cross-validation based on...

View source: R/functions.R

create_folds_mcR Documentation

Creation of folds for group-out cross-validation based on Monte Carlo method.

Description

Function takes input vector of variables which will be used to group input objects. It creates folds with approaximately equal number of objects in each fold. All object of the same group put in the single fold.

Usage

create_folds_mc(
  v,
  nfolds = "auto",
  max_iter = 1000,
  start_opt_param = 100,
  error_limit = NA,
  seed = 0
)

Arguments

v

input vector of group variables.

nfolds

maximum number of folds. But if it is not possible to create the specified number of folds its number will be automatically decreased.

max_iter

maximum number of Monte Carlo iterations.

start_opt_param

strting parameter of Monter Carlo optimization.

error_limit

if final error will be greater than this values results will be discarded.

seed

seed for random number generator to reproduce results.

Value

vector of folds numbers for each input object.

Examples

df <- data.frame(A=runif(100), B=runif(100), C=sample(LETTERS[1:10], 100, TRUE))
res <- create_folds_mc(df$C, 5)

DrrDom/pfpp documentation built on April 17, 2024, 10:24 a.m.