caret (version 5.15-61)

update.train: Update and Re-fit a Model

Description

update allows a user to over-ride the tuning parameter selection process by specifying a set of tuning parameters.

Usage

## S3 method for class 'train':
update(object, param = NULL, ...)

Arguments

object
an object of class train
param
a data frame or named list of all tuning parameters
...
not currently used

Value

Details

To update the model, the training data must be stored in the model object (see the option returnData in trainControl. Also, all tuning parameters must be specified (with the preceding dot in the name).

All other options are held constant, including the original pre-processing (if any), options passed in using code{...} and so on.

When printing, the verbiage "The tuning parameter was set manually." is used to describe how the tuning parameters were created.

See Also

train, trainControl

Examples

Run this code
data(iris)
TrainData <- iris[,1:4]
TrainClasses <- iris[,5]

knnFit1 <- train(TrainData, TrainClasses,
                 method = "knn",
                 preProcess = c("center", "scale"),
                 tuneLength = 10,
                 trControl = trainControl(method = "cv"))

update(knnFit1, list(.k = 3))

Run the code above in your browser using DataCamp Workspace