Description Usage Arguments Value Examples
This function does Cross-Validation k-Nearest Neighbors prediction.
1 | my_knn_cv(train, cl, k_nn, k_cv)
|
train |
The training data frame. |
cl |
A vector of true class value of |
k_nn |
An int representing the number of neighbors in knn. |
k_cv |
An int representing the number of folds in cv. |
A list of predicted classes class
and,
the mean rate of cross-validation misclassification error cv-err
.
1 2 3 4 5 | train <- na.omit(my_penguins) %>% dplyr::select(body_mass_g, bill_length_mm,
bill_depth_mm,
flipper_length_mm)
cl <- na.omit(my_penguins) %>% dplyr::select(species)
my_knn_cv(train, cl, 5, 5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.