Trains a prediction model from an scPred object stored in a Seurat object

trainModel(
  object,
  model = "svmRadial",
  preProcess = c("center", "scale"),
  resampleMethod = "cv",
  number = 5,
  seed = 66,
  tuneLength = 3,
  metric = c("ROC", "PR", "Accuracy", "Kappa"),
  returnData = FALSE,
  savePredictions = "final",
  allowParallel = FALSE,
  reclassify = NULL
)

Arguments

object

An Seurat or scPred object after running getFeatureSpace

model

Classification model supported via caret package. A list of all models can be found here:

preProcess

A string vector that defines a pre-processing of the predictor data. Current possibilities are "BoxCox", "YeoJohnson", "expoTrans", "center", "scale", "range", "knnImpute", "bagImpute", "medianImpute", "pca", "ica" and "spatialSign". The default is "center" and "scale. See preProcess and trainControl on the procedures and how to adjust them https://topepo.github.io/caret/available-models.html Default: support vector machine with radial kernel

resampleMethod

Resample model used in trainControl function from caret. Default: K-fold cross validation

number

Number of iterations for resample method. See trainControl function

seed

Numeric seed for resample method. Fixed to ensure reproducibility

tuneLength

An integer denoting the amount of granularity in the tuning parameter grid. By default, this argument is the number of levels for each tuning parameters that should be generated by train. See `?caret::train` documentation

metric

Performance metric to be used to select best model: `ROC` (area under the ROC curve), `PR` (area under the precision-recall curve), `Accuracy`, and `Kappa`

returnData

If TRUE, training data is returned within scPred object.

savePredictions

Specifies the set of hold-out predictions for each resample that should be returned. Values can be either "all", "final", or "none".

allowParallel

Allow parallel processing for resampling?

reclassify

Cell types to reclassify using a different model

Value

A list of train objects for each cell class (e.g. cell type). See train function for details.

Author

Jose Alquicira Hernandez