my_knn_cv: k-Nearest Neighbors Cross-Validation

Description Usage Arguments Value Examples

View source: R/my_knn_cv.R

Description

This function predicts output from existing variables by using k-nearest neighbors cross-validation

Usage

1
my_knn_cv(train, cl, k_nn, k_cv)

Arguments

train

The input data frame.

cl

The true class value of training data.

k_nn

The integer representing the number of neighbors.

k_cv

The integer representing the number of folds.

Value

List with objects:

class

a vector of the predicted class Y hat for all observations

df

a numeric with the cross-validation misclassification error

Examples

1
my_knn_cv(my_iris[, -5], my_iris$Species, 5, 5)

jingnanyuan/STAT302package documentation built on April 2, 2020, 9:42 p.m.