getKNNpredictionFromFormula: Predict classification using KNN

Description Usage Arguments Value Author(s) See Also

Description

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.

Usage

1
2
3
4
5
	getKNNpredictionFromFormula(model.formula,
	                            trainData,
	                            testData,
	                            Outcome = "CLASS",
	                            nk = 3)

Arguments

model.formula

An object of class formula with the formula to be used

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 trainData, but with the data set to be predicted

Outcome

The name of the column in trainData that stores the variable to be predicted by the model

nk

The number of neighbors used to generate the KNN classification

Value

prediction

A vector with the predicted outcome for the testData data set

prob

The proportion of k neighbors that predicted the class to be the one being reported in prediction

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

Author(s)

Jose G. Tamez-Pena and Antonio Martinez-Torteya

See Also

predict.fitFRESA, knn


FRESA.CAD documentation built on Jan. 13, 2021, 3:39 p.m.