Description Usage Arguments Value Examples
This function performs a k-neareast neighbors cross-validation. predicts "species" using four covariates bill_length_mm, bill_depth_mm, flipper_length_mm, and body_mass_g.
1 | my_knn_cv(train, cl, k_nn, k_cv)
|
train |
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. |
A list of the predicted class and the CV misclassification rate.
1 2 3 4 | penguins_01 <- na.omit(my_penguins)
species_outcome <- dplyr::pull(penguins_01, var = "species")
penguins_01 <- dplyr::select(penguins_01, 3:6)
my_knn_cv(penguins_01, species_outcome, 5, 10)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.