Description Usage Arguments Value Examples
This function is used to predict a class using the k-nearest neighbors algorithm
1 | my_knn_cv(train, cl, k_nn, k_cv)
|
train |
Data frame of covariate values used to predict a class |
cl |
String indicating the output class to predict |
k_nn |
Numeric for the number of neighbors to use in the k-nearest neighbors algorithm |
k_cv |
Numeric for the number of folds for cross-validation |
list with the cross-validation error and a vector of the predicted class
1 2 | my_knn_cv(my_penguins[complete.cases(my_penguins), c(1, 3:6)], "species", 5, 5)
my_knn_cv(my_penguins[complete.cases(my_penguins), c(1, 3:5)], "species", 10, 10)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.