my_knn_cv: k-Nearest Neighbors Cross-Validation

Description Usage Arguments Value Examples

Description

Predict output class species using covariates bill_length_mm, bill_depth_mm, flipper_length_mm, and body_mass_g.

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

class: a vector of the predicted class Ŷ i for all observation.

cv_err: a numeric with the cross-validation misclassification error.

Examples

1
my_knn_cv(data_peng, test, k_nn = 1, k_cv = 5)

SabrinaYuY/project3 documentation built on Dec. 18, 2021, 12:02 p.m.