my_knn_cv: K-Nearest Neighbors Cross-Validation Function

Description Usage Arguments Value Examples

View source: R/my_knn_cv.R

Description

This function performs a k-Nearest Neighbors Cross-Validation in R

Usage

1
my_knn_cv(train, cl, k_nn, k_cv)

Arguments

train

Input data frame to be validated

cl

true class value of the training data

k_nn

integer representing the number of neighbors

k_cv

integer representing the number of folds

Value

a list with objects, which has class: a vector of the predicted class ^Y_i for all observations, and cv_err: a numeric with the cross-validation misclassification error;

Examples

1
my_knn_cv(train = my_iris[, -5], cl = my_iris$Species, k_nn = 5, k_cv = 5)

SimonaLiao/Stat302Package documentation built on March 23, 2020, 9:56 p.m.