R/probFunction.R

probFunction <- function(method, modelFit, newdata, preProc = NULL, param = NULL)
{
  if(!is.null(preProc)) newdata <- predict(preProc, newdata)

  obsLevels <- levels(modelFit)
  
  classProb <- method$prob(modelFit = modelFit, 
                           newdata = newdata, 
                           submodels = param)  
  if(!is.data.frame(classProb) & is.null(param))
  {
    classProb <- as.data.frame(classProb)
    if(!is.null(obsLevels)) classprob <- classProb[, obsLevels]
  }
  classProb
}

Try the caret package in your browser

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

caret documentation built on May 2, 2019, 5:47 p.m.