Description Usage Arguments Examples
A function to build prediction models for the training set.
1 2 3 4 5 6 7 8 9 | caretModels(
TrainSet,
resp.var,
trControl,
preProcess,
tuneLength,
metric,
methods
)
|
TrainSet |
The training set. |
resp.var |
Indicate the name of the column in the training set that contains the response variable. |
trControl |
A list of values that define how this function
acts. See |
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 no pre-processing. See
|
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 |
metric |
A string that specifies what summary metric will
be used to select the optimal model. By default, possible values
are "RMSE" and "Rsquared" for regression and "Accuracy" and
"Kappa" for classification. If custom performance metrics are
used (via the |
methods |
Similarly to the |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ctrl.reg <- trainControl(method = 'cv', # k-fold cross-validation
number = 5, # k = 5
search = 'grid', # use grid search over paramter space
summaryFunction = defaultSummary,
selectionFunction = 'oneSE', # select optimal tuning parameters by "one standard error" rule
savePredictions = 'final') # save predicted values of the final model
boston.models <- caretModels(boston.training, # training set
resp.var='cmedv', # response variable
trControl = ctrl.reg,
preProcess = c('center', 'scale'),
tuneLength = 7,
metric = 'RMSE',
methods = 'svmRadial')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.