Learn R Programming

FastKNN (version 0.0.1)

k.nearest.neighbors: k-Nearest Neighbors the k.nearest.neigbors gives the list of points (k-Neigbours) that are closest to the row i in descending order.

Description

k-Nearest Neighbors the k.nearest.neigbors gives the list of points (k-Neigbours) that are closest to the row i in descending order.

Usage

k.nearest.neighbors(i, distance_matrix, k = 5)

Arguments

i
is from the numeric class and is a row from the distance_matrix.
distance_matrix
is a nxn matrix.
k
is from the numeric class and represent the number of neigbours that the function will return.

Value

a k vector with the k closest neigbours to the i observation.

Details

The output of this function is used in the knn_test_function function.

See Also

order