my_knn_cv: k-Nearest Neighbors Cross-Validation

Description Usage Arguments Value Examples

View source: R/my_knn_cv.R

Description

This function predicts the output class from a given set of covariates and actual class values using the k-nearest neighbors approach of identifying patterns in data points near each other.

Usage

1
my_knn_cv(train, cl, k_nn, k_cv)

Arguments

train

An input data frame with all the values of the predictor variables.

cl

The (actual) response values corresponding to each of the values from train.

k_nn

A numeric integer representing the number of neighbors considered.

k_cv

A numeric integer representing the number of folds for which to divide the observations in train.

Value

A list with elements class and cv_err, where class is a vector of the predicted classes for all observations, and cv_err is a numeric with the cross-validation misclassification error.

Examples

1
2

marquesjchacon/myfirstpackage documentation built on April 2, 2020, 9:42 p.m.