my_knn_cv: 'my_knn_cv' Function

Description Usage Arguments Value Examples

View source: R/my_knn_cv.R

Description

This function predict output class using covariates.

Usage

1
my_knn_cv(train, cl, k_nn, k_cv)

Arguments

train

an input data frame.

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:

class: a vector of the predicted class Y_hat for all observations, cv_err: a numeric with the cross-validation misclassification error.

Examples

1
my_knn_cv(my_penguins[, 3:6], my_penguins$species, 5, 5)

Cherry-ty-Pan/STAT302package documentation built on Dec. 17, 2021, 2 p.m.