Learn R Programming

EZtune (version 1.0.0)

eztune.cv: Cross-Validated Accuracy for Supervised Learning Model

Description

eztune.cv is a function that will return the cross-validated accuracy for a model generated by the function eztune. The function eztune can tune a model using resubstitution or cross-validation. If the resubstitution is used to tune the model, the accuracy obtained from the function is inflated. The function eztune.cv will return a cross-validated accuracy for such a model.

Usage

eztune.cv(x, y, model, fold = 10)

Arguments

x

Matrix or data frame containing the dependent variables used to create the model.

y

Numeric vector of 0s and 1s for the response used to create the model.

model

Object generated with the function eztune.

fold

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.

Examples

Run this code
# NOT RUN {
library(mlbench)
data(Glass)

glass <- Glass[as.numeric(as.character(Glass$Type)) < 3, ]
glass <- glass[sample(1:nrow(glass), 80), ]
y <- ifelse(glass$Type == 1, 0, 1)
x <- glass[, 1:9]

glass_svm <- eztune(x, y, type = "binary", method = "svm")
eztune.cv(x, y, glass_svm)

# }

Run the code above in your browser using DataLab