eztune_cv {EZtune} | R Documentation |
Cross Validated Accuracy for Supervised Learning Model
Description
eztune_cv
returns the cross-validated
loss measures for a model returned by eztune
.
The function eztune
can tune a model using validation data,
cross validation, data splitting, or resubstitution. If resubstitution
or a data splitting method (via the fast
option) is used to
tune the model, the accuracy obtained from the function
may not be accurate. The function eztune_cv
will return
cross-validated accuracy measures for any model returned by eztune
.
Usage
eztune_cv(x, y, model, cross = 10)
Arguments
x |
Matrix or data frame containing the dependent variables used to create the model. |
y |
Vector of the response used to create the model. Can be either numeric or a factor. |
model |
An Object of class |
cross |
Number of folds to use for n-fold cross-validation. |
Value
Function returns a numeric value that represents the cross-validated accuracy of the model. Both classification accuracy and the AUC are returned for models with a binary response. MSE and mean absolute error (MAE) are returned for models with a continuous response.
accuracy |
Cross-validated classification accuracy. |
auc |
Cross-validated AUC. |
mse |
Cross-validated MSE. |
mae |
Cross-validated MAE. |
Examples
library(mlbench)
data(Sonar)
sonar <- Sonar[sample(1:nrow(Sonar), 100), ]
y <- sonar[, 61]
x <- sonar[, 1:10]
sonar_default <- eztune(x, y)
eztune_cv(x, y, sonar_default)
sonar_svm <- eztune(x, y, fast = FALSE, cross = 3)
eztune_cv(x, y, sonar_svm)
sonar_gbm <- eztune(x, y, method = "gbm", fast = 50)
eztune_cv(x, y, sonar_gbm)