Description Usage Arguments Value Examples
This function uses cross validation to assess how predictions made using k-nearest neighbors models can generalize to independent data sets.
1 | my_knn_cv(train, cl, k_nn, k_cv)
|
train |
Input data frame. |
cl |
True class of the training data. |
k_nn |
Integer indicating that the model will use |
k_cv |
Integer indicating that we will use |
a list with class, a vector of the predicted class for each observation, and cv_err, a numeric with the cross-validation misclassification error.
1 2 3 | train <- na.omit(my_penguins)[, c(3:6)]
cl <- na.omit(my_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.