Description Usage Arguments Value Examples
This function performs predicts an output class using covariates given in training data.
1 | my_knn_cv(train, cl, k_nn, k_cv)
|
train |
An input data frame. |
cl |
The true class value of the training data. |
k_nn |
An integer representing the number of neighbors to use. |
k_cv |
An integer representing the number of folds to use. |
A list with objects class
(a vector of the predicted class
for all observations) and cv_err
(a numeric with the
cross-validation misclassification error).
1 2 3 4 | train_dat <- subset(na.omit(my_penguins), select = c(bill_length_mm,
bill_depth_mm, flipper_length_mm, body_mass_g))
correct <- data.frame("species" = na.omit(my_penguins)$species)
my_knn_cv(train_dat, correct, 1, 5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.