Description Usage Arguments Value Examples
Predicts the class of the input data using k-nearest-neighbors and performs cross-validation to determine the misclassification error of the model.
1 | my_knn_cv(train, cl, k_nn, k_cv)
|
train |
Data frame input of training data. |
cl |
Vector input of true class values for the training data. |
k_nn |
Integer representing the number of neighbors. |
k_cv |
Integer representing the number of folds. |
List including a vector of class predictions for all observations and a numeric with the cross-validation misclassification error.
1 2 3 4 | penguins <- my_penguins %>% tidyr::drop_na()
train <- penguins[,3:6]
cl <- penguins[,1]
my_knn_cv(train, cl, 1, 5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.