R/balancedFolds.R

Defines functions balancedFolds

balancedFolds <- function(class.column.factor, cross.outer)
{
  #stolen from MCREstimate package
  # used for stratified(balanced) classification or regression
  # get balanced folds from pamr
  sampleOfFolds  <- get("balanced.folds",envir=asNamespace("pamr"))(class.column.factor, nfolds=cross.outer)
  permutated.cut <- rep(0,length(class.column.factor))
  for (sample in 1:cross.outer)
  {
    cat(sample,"\n")
    permutated.cut[sampleOfFolds[[sample]]] <- sample
  }
  return(permutated.cut)
}

Try the c060 package in your browser

Any scripts or data that you put into this service are public.

c060 documentation built on May 31, 2017, 1:47 a.m.