Description Usage Arguments Value Examples
Function doing Cross Validation test for the KNN model.
1 | my_knn_cv(train, trueValues, n, f)
|
train |
DataFrame, input including the training variable. |
trueValues |
Vector, input the true class value of training data. |
n, |
Numeric input, is the number of neighbors. |
f |
Numeric input 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]
trueValues <- penguins_data$species
my_knn_cv(train, trueValues, 5, 5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.