Description Usage Arguments Value Author(s) Examples
View source: R/knn_classifier.R
Application of knn algorithm for classification
1 2 3 | knn_classifier(data = NULL, p_train = NULL, train = NULL,
test = NULL, k = 3, target = is.numeric(),
dist_method = "euclidean", probs = F)
|
data |
Dataframe that will be used |
p_train |
Percentage of rows that will be used as train |
train |
Dataset used as train set (Only when data and p_train are NULL) |
test |
Dataset used as test set (Only when data and p_train are NULL) |
k |
Number of neighbors used |
target |
Integer with the column number of the target variable |
dist_method |
Method to calculate the distance between data. Only "Euclidean" available |
probs |
If TRUE, the results are given in probability. Default is FALSE. |
Returns a list with the original dataset + predicted values and a confusion matrix with several data.
Alberto Almui?a
1 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.