my_knn_cv | R Documentation |
It uses the k-nearest-neighbors method to predict the output. For example, it can predict the class Species in iris data using covariates Sepal.Length, Sepal.Width, Petal.Length, and Petal.Width.
my_knn_cv(train, cl, k_nn, k_cv)
train |
Input data frame. |
cl |
A data frame that contains the true class value of the
input training data |
k_nn |
Integer representing the number of neighbors. |
k_cv |
Integer representing the number of folds. |
A list containing the following objects:
class: objects class that contains a vector of the predicted class for all observations.
cv_error: a numeric represents cross-validation misclassification error.
# an example that uses iris data
my_knn_cv(iris[, -5], iris[, 5], 5, 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.