Rborist (version 0.1-17)

PreFormat: Preformatting for Training with Warm Starts

Description

Presorts and formats training input into a form suitable for subsequent training by Rborist command. Saves unnecessary recomputation of this form when iteratively retraining.

Usage

# S3 method for default
PreFormat(x, verbose)

Arguments

x

the design matrix expressed as either a data.frame object with numeric and/or factor columns or as a numeric matrix.

verbose

indicates whether to output progress of preformatting.

Value

PreFormat

a list consisting of two objects:

predBlock a list of presorted and formatted predictor information:

blockFac a matrix of zero-based factor predictor values.

blockFacSparse a sparse block of factor predictor values.

blockNum a matrix of dense numeric predictor values.

blockNumSparse a sparse block of numeric predictor values. nPredFac the number of factor predictors.

nRow the number of training rows.

nPredFac the number of factor-valued predictors.

facCard a vector of the factor cardinalities.

nPredNum the number of numerical predictors. signature a list consisting of training information needed for separate testing and prediction:

predMap a vector mapping core indices to front-end counterparts.

colNames a vector of strings containing the training column names.

rowNames a vector of strings containing the training row names.

level a vector of strings containing the training response factor levels.

Examples

Run this code
# NOT RUN {
  
# }
# NOT RUN {
    data(iris)
    pt <- PreFormat(iris[,-5])

    ppTry <- seq(0.2, 0.5, by= 0.3/10)
    nIter <- length(ppTry)
    rsq <- numeric(nIter)
    for (i in 1:nIter) {
      rb <- Rborist(pt, iris[,5], predProb=ppTry[i])
      rsq[i] = rb$validiation$rsq
    }
  
# }

Run the code above in your browser using DataLab