Description Usage Arguments Value Examples
This function does the Cross Validation test for the kth nearest neighbor predict model.
1 | my_knn_cv(train, cl, k_nn, k_cv)
|
train |
Data frame input that record X variable. |
cl |
Vector input of true class value of training data. |
k_nn, |
Numeric input representing the number of neighbors. |
k_cv, |
Numeric input representing the number of folds. |
a list includes class
, a vector of the predicted class y-hat
for all observations, cv_err
, a numeric of the cross-validation
misclassification error.
1 2 3 4 | penguins_data <- na.omit(my_penguins)
train <- penguins_data[, 3:6]
cl <- penguins_data$species
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.