find_Knn_best_k {KMEANS.KNN} | R Documentation |
find_Knn_best_k
Description
This function finds the best k-value for KNN based on the provided data.
Usage
find_Knn_best_k(data, target_column, k_values, Prop_train = 0.8)
Arguments
data |
A dataframe containing the dataset to be used. |
target_column |
A string specifying the name of the target column in the dataset. |
k_values |
A numeric vector containing the different k-values to be tested. |
Prop_train |
A numeric value between 0 and 1 indicating the proportion of the dataset to be used for training. |
Value
A list containing a dataframe with k-values and their corresponding accuracies, and the best k-value with its accuracy.
Examples
data(iris)
find_Knn_best_k(iris,"Species",1:10,Prop_train=0.8)
[Package KMEANS.KNN version 0.1.0 Index]