my_knn_cv: K-Nearest Neighbors Cross-Validation function

Description Usage Arguments Value Examples

View source: R/my_knn_cv.R

Description

This function predicts output class.

Usage

1
my_knn_cv(train, cl, k_nn, k_cv)

Arguments

train

Input data frame.

cl

True class value of your training data.

k_nn

Integer representing the number of neighbors.

k_cv

Integer representing the number of folds.

Value

List with objects: a vector of the predicted class Y for all observations class and a numeric with the cross-validation misclassification error cv_err.

Examples

1
2
3
data <- na.omit(my_penguins)
train <- data[, 3:6]
my_knn_cv(train, data$species, 1, 5)

JudyTi/STAT302package documentation built on Dec. 18, 2021, 2:32 a.m.