Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

update.train

Update or Re-fit a Model


Description

update allows a user to over-ride the tuning parameter selection process by specifying a set of tuning parameters or to update the model object to the latest version of this package.

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

Details

If the model object was created with version 5.17-7 or earlier, the underlying package structure was different. To make old train objects consistent with the new structure, use param = NULL to get the same object back with updates.

To update the model parameters, the training data must be stored in the model object (see the option returnData in trainControl. Also, all tuning parameters must be specified in the param slot. 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.

Value

a new train object

Author(s)

Max Kuhn

See Also

Examples

## Not run: 
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))

## End(Not run)

caret

Classification and Regression Training

v6.0-86
GPL (>= 2)
Authors
Max Kuhn [aut, cre], Jed Wing [ctb], Steve Weston [ctb], Andre Williams [ctb], Chris Keefer [ctb], Allan Engelhardt [ctb], Tony Cooper [ctb], Zachary Mayer [ctb], Brenton Kenkel [ctb], R Core Team [ctb], Michael Benesty [ctb], Reynald Lescarbeau [ctb], Andrew Ziem [ctb], Luca Scrucca [ctb], Yuan Tang [ctb], Can Candan [ctb], Tyler Hunt [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.