Performing cross-validation with the e1071 package
Besides implementing a
loop function to perform the k-fold cross-validation, you can use the
tuning function (for example,
tune.knn.) within the
e1071 package to obtain the minimum error value. In this recipe, we will illustrate how to use
tune.svm to perform the 10-fold cross-validation and obtain the optimum classification model.
In this recipe, we continue to use the telecom
churn dataset as the input data source to perform 10-fold cross-validation.
How to do it...
Perform the following steps to retrieve the minimum estimation error using cross-validation:
tune.svmon the training dataset,
trainset, with the 10-fold cross-validation ...