Description Usage Arguments Value Examples
Builds a classification model for data train
using the k-nearest
neighbors algorithm with k = k_nn
and applies k-fold
cross-validation with k = k_cv
.
1 | my_knn_cv(train, cl, k_nn, k_cv)
|
train |
Data frame used for training the model. |
cl |
Vector of true classifications for entries in |
k_nn |
Integer indicating how many neighbors should be considered in the k-nearest neighbors algorithm. |
k_cv |
Integer indicating how many folds |
A list containing a vector of classifications predicted by the model
using train
as both the training data and the testing data and a
numeric representing the cross-validation error from the k-fold
cross-validation.
1 2 3 4 | train <- na.omit(my_penguins)[,3:6]
cl <- na.omit(my_penguins)[1]
my_knn_cv(train, cl, 1, 5)
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.