my_knn_cv: k-Nearest Neighbors Cross-Validation

Description Usage Arguments Value Examples

View source: R/my_knn_cv.R

Description

This function cauculated k-Nearest Neighbors Cross-Validation

Usage

1
my_knn_cv(train, cl, k_nn, k_cv)

Arguments

train

A data frame to be calculated for knn Cross-Validation.

cl

A true class value of your data.

k_nn

An integer representing the number of neighbors.

k_cv

A integer representing the number of folds.

Value

A list with objects with vector of predicted class for observations and numeric with the cross-validation misclassification error.

Examples

1
2
3
train <- my_gapminder[4]
cl <- unlist(my_gapminder[1])
my_knn_cv(train, cl, 5, 5)

YZhien/final documentation built on Dec. 18, 2021, 7:23 p.m.