getKNNpredictionFromFormula | R Documentation |
This function will return the classification of the samples of a test set using a k-nearest neighbors (KNN) algorithm with euclidean distances, given a formula and a train set.
getKNNpredictionFromFormula(model.formula,
trainData,
testData,
Outcome = "CLASS",
nk = 3)
model.formula |
An object of class |
trainData |
A data frame with the data to train the model, where all variables are stored in different columns |
testData |
A data frame similar to |
Outcome |
The name of the column in |
nk |
The number of neighbors used to generate the KNN classification |
prediction |
A vector with the predicted outcome for the |
prob |
The proportion of k neighbors that predicted the class to be the one being reported in |
binProb |
The proportion of k neighbors that predicted the class of the outcome to be equal to 1 |
featureList |
A vector with the names of the features used by the KNN procedure |
Jose G. Tamez-Pena and Antonio Martinez-Torteya
predict.fitFRESA,
knn
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.